MCPcopy Index your code
hub / github.com/parse-community/parse-server / route

Method route

src/PromiseRouter.js:55–84  ·  view source on GitHub ↗
(method, path, ...handlers)

Source from the content-addressed store, hash-verified

53 }
54
55 route(method, path, ...handlers) {
56 switch (method) {
57 case 'POST':
58 case 'GET':
59 case 'PUT':
60 case 'DELETE':
61 break;
62 default:
63 throw 'cannot route method: ' + method;
64 }
65
66 let handler = handlers[0];
67
68 if (handlers.length > 1) {
69 handler = function (req) {
70 return handlers.reduce((promise, handler) => {
71 return promise.then(() => {
72 return handler(req);
73 });
74 }, Promise.resolve());
75 };
76 }
77
78 this.routes.push({
79 path: path,
80 method: method,
81 handler: handler,
82 layer: new Layer(path, null, handler),
83 });
84 }
85
86 // Returns an object with:
87 // handler: the handler that should deal with this request

Callers 15

mountOntoFunction · 0.80
mountRoutesMethod · 0.80
mountRoutesMethod · 0.80
mountRoutesMethod · 0.80
mountRoutesMethod · 0.80
mountRoutesMethod · 0.80
mountRoutesMethod · 0.80
mountRoutesMethod · 0.80
mountRoutesMethod · 0.80
mountRoutesMethod · 0.80
mountRoutesMethod · 0.80
mountRoutesMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected