index.js
function invokeHTTPHandler(handler, args, req, res, done) {
  // inject parsed parameters into request
  req.params = args;
  // call handler with typical HTTP request/response parameters
  let result = handler(req, res);
  // handle results that are not a trusted Promise with Promise.resolve()
  // which also supports other then-ables
  if (result instanceof Promise === false) {
    result = Promise.resolve(result);
  }
  return result.then(() => done()).catch(done);
}
function invokeHTTPHandler(handler, args, req, res, done) {
  // inject parsed parameters into request
  req.params = args;
  // call handler with typical HTTP request/response parameters
  let result = handler(req, res);
  // handle results that are not a trusted Promise with Promise.resolve()
  // which also supports other then-ables
  if (result instanceof Promise === false) {
    result = Promise.resolve(result);
  }
  return result.then(() => done()).catch(done);
}
function invokeHTTPHandler ( handler , args , req , res , done ) { // inject parsed parameters into request req . params = args ; // call handler with typical HTTP request/response parameters let result = handler ( req , res ) ; // handle results that are not a trusted Promise with Promise.resolve() // which also supports other then-ables if ( result instanceof Promise === false ) { result = Promise . resolve ( result ) ; } return result . then ( ( ) => done ( ) ) . catch ( done ) ; }
Invoke the provided request handler function.
This handler function must send a response.
If the handler returns a Promise,
it will handle the error if the Promise is rejected.
@private
Invoke the provided request handler function . This handler function must send a response . If the handler returns a Promise it will handle the error if the Promise is rejected .