src/index.js
//Middleware to check if a project exists
Middleware to check if a project exists
Middleware to check if a project exists
function checkProjectExists(req, res, next) {
    const { id } = req.params;
    if (!findProject(id)) {
        return res.status(400).json({ error: 'Project not found' });
    }
    return next();
}
function checkProjectExists ( req , res , next ) { const { id } = req . params ; if ( ! findProject ( id ) ) { return res . status ( 400 ) . json ( { error : 'Project not found' } ) ; } return next ( ) ; }
Middleware to check if a project exists
Middleware to check if a project exists