src/index.js
//Middleware to check if a project doesn't exists
Middleware to check if a project doesn't exists
Middleware to check if a project doesn ' t exists
function checkProjectNotExists(req, res, next) {
    const { id } = req.body;
    if (findProject(id)) {
        return res.status(400).json({ error: 'Project already exists' });
    }
    return next();
}
function checkProjectNotExists ( req , res , next ) { const { id } = req . body ; if ( findProject ( id ) ) { return res . status ( 400 ) . json ( { error : 'Project already exists' } ) ; } return next ( ) ; }
Middleware to check if a project doesn't exists
Middleware to check if a project doesn ' t exists