example/lib/controllers/favorites.js
function(teamId, req) {
        const favoritesList = req.app.locals.favoritesList
        const index = favoritesList.findIndex(t => t.id == teamId)
        if(index < 0) {
            const err = new Error('Team is not parte of Favorites!!!')
            err.status = 409
            throw err
        }
        favoritesList.splice(index, 1)
    }
function(teamId, req) {
        const favoritesList = req.app.locals.favoritesList
        const index = favoritesList.findIndex(t => t.id == teamId)
        if(index < 0) {
            const err = new Error('Team is not parte of Favorites!!!')
            err.status = 409
            throw err
        }
        favoritesList.splice(index, 1)
    }
function ( teamId , req ) { const favoritesList = req . app . locals . favoritesList const index = favoritesList . findIndex ( t => t . id == teamId ) if ( index < 0 ) { const err = new Error ( 'Team is not parte of Favorites!!!' ) err . status = 409 throw err } favoritesList . splice ( index , 1 ) }
This is a synchronous action that does not do any IO.
Simply returning with NO exceptions just means success and
connect-controller will send a 200 response status.
This is a synchronous action that does not do any IO . Simply returning with NO exceptions just means success and connect - controller will send a 200 response status .