MCPcopy Create free account
hub / github.com/dadi/api / handler

Function handler

dadi/lib/index.js:951–968  ·  view source on GitHub ↗
(req, res, next)

Source from the content-addressed store, hash-verified

949 const route = typeof arguments[0] === 'string' ? args.shift() : null
950
951 const handler = function(req, res, next) {
952 if (!(req.method && req.method.toLowerCase() === verb)) {
953 next()
954 }
955
956 // push the next route on to the bottom of callback stack in case none of these callbacks send a response
957 args.push(next)
958
959 const doCallbacks = function(i) {
960 return function(err) {
961 if (err) return next(err)
962
963 args[i](req, res, doCallbacks(++i))
964 }
965 }
966
967 doCallbacks(0)()
968 }
969
970 // if there is a route provided, only call for matching requests
971 if (route) {

Callers 1

clients.jsFile · 0.85

Calls 1

doCallbacksFunction · 0.85

Tested by

no test coverage detected