Skip to content

Commit 6c4e7da

Browse files
committed
Reverts calling next() after response
1 parent f5b94b5 commit 6c4e7da

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
@@ -271,7 +271,9 @@ class ParseServer {
271271
api.use('/', bodyParser.urlencoded({extended: false}), new PublicAPIRouter().expressRouter());
272272

273273
api.use(bodyParser.json({ 'type': '*/*' , limit: maxUploadSize }));
274+
api.use(middlewares.allowCrossDomain);
274275
api.use(middlewares.allowMethodOverride);
276+
api.use(middlewares.handleParseHeaders);
275277

276278
let routers = [
277279
new ClassesRouter(),
@@ -297,8 +299,6 @@ class ParseServer {
297299
}, []);
298300

299301
let appRouter = new PromiseRouter(routes, appId);
300-
appRouter.use(middlewares.allowCrossDomain);
301-
appRouter.use(middlewares.handleParseHeaders);
302302

303303
batch.mountOnto(appRouter);
304304

src/PromiseRouter.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export default class PromiseRouter {
2323
// location: optional. a location header
2424
constructor(routes = [], appId) {
2525
this.routes = routes;
26-
this.middlewares = [];
2726
this.appId = appId;
2827
this.mountRoutes();
2928
}
@@ -39,10 +38,6 @@ export default class PromiseRouter {
3938
}
4039
};
4140

42-
use(middleware) {
43-
this.middlewares.push(middleware);
44-
}
45-
4641
route(method, path, ...handlers) {
4742
switch(method) {
4843
case 'POST':
@@ -115,8 +110,7 @@ export default class PromiseRouter {
115110
this.routes.forEach((route) => {
116111
let method = route.method.toLowerCase();
117112
let handler = makeExpressHandler(this.appId, route.handler);
118-
let args = [].concat(route.path, this.middlewares, handler);
119-
expressApp[method].apply(expressApp, args);
113+
expressApp[method].call(expressApp, route.path, handler);
120114
});
121115
return expressApp;
122116
};

0 commit comments

Comments
 (0)