Skip to content

Commit 1687c89

Browse files
committed
Reverts calling next() after response
1 parent 93822e0 commit 1687c89

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

src/ParseServer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,9 @@ class ParseServer {
273273
api.use('/', bodyParser.urlencoded({extended: false}), new PublicAPIRouter().expressRouter());
274274

275275
api.use(bodyParser.json({ 'type': '*/*' , limit: maxUploadSize }));
276+
api.use(middlewares.allowCrossDomain);
276277
api.use(middlewares.allowMethodOverride);
278+
api.use(middlewares.handleParseHeaders);
277279

278280
let appRouter = ParseServer.promiseRouter({ appId });
279281
api.use(appRouter.expressRouter());
@@ -322,8 +324,6 @@ class ParseServer {
322324
}, []);
323325

324326
let appRouter = new PromiseRouter(routes, appId);
325-
appRouter.use(middlewares.allowCrossDomain);
326-
appRouter.use(middlewares.handleParseHeaders);
327327

328328
batch.mountOnto(appRouter);
329329
return appRouter;

src/PromiseRouter.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ export default class PromiseRouter {
3939
// location: optional. a location header
4040
constructor(routes = [], appId) {
4141
this.routes = routes;
42-
this.middlewares = [];
4342
this.appId = appId;
4443
this.mountRoutes();
4544
}
@@ -55,10 +54,6 @@ export default class PromiseRouter {
5554
}
5655
};
5756

58-
use(middleware) {
59-
this.middlewares.push(middleware);
60-
}
61-
6257
route(method, path, ...handlers) {
6358
switch(method) {
6459
case 'POST':
@@ -117,8 +112,7 @@ export default class PromiseRouter {
117112
this.routes.forEach((route) => {
118113
let method = route.method.toLowerCase();
119114
let handler = makeExpressHandler(this.appId, route.handler);
120-
let args = [].concat(route.path, this.middlewares, handler);
121-
expressApp[method].apply(expressApp, args);
115+
expressApp[method].call(expressApp, route.path, handler);
122116
});
123117
return expressApp;
124118
};

0 commit comments

Comments
 (0)