bin/middleware.js
function executeController(server, controller, req, res) {
    try {
        const promise = controller.call(server, req, res);
        if (promise && typeof promise.catch === 'function') {
            promise.catch(function(err) {
                res.status(500).send(err);
            });
        }
    } catch (err) {
        res.send(err);
    }
}
function executeController(server, controller, req, res) {
    try {
        const promise = controller.call(server, req, res);
        if (promise && typeof promise.catch === 'function') {
            promise.catch(function(err) {
                res.status(500).send(err);
            });
        }
    } catch (err) {
        res.send(err);
    }
}
function executeController ( server , controller , req , res ) { try { const promise = controller . call ( server , req , res ) ; if ( promise && typeof promise . catch === 'function' ) { promise . catch ( function ( err ) { res . status ( 500 ) . send ( err ) ; } ) ; } } catch ( err ) { res . send ( err ) ; } }
Safely execute a controller.
@param server
@param controller
@param req
@param res
Safely execute a controller .