Skip to content

Commit bd3b512

Browse files
committed
Reverts calling next() after response
1 parent 9fe383d commit bd3b512

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/ParseServer.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,9 @@ class ParseServer {
269269
api.use('/', bodyParser.urlencoded({extended: false}), new PublicAPIRouter().expressRouter());
270270

271271
api.use(bodyParser.json({ 'type': '*/*' , limit: maxUploadSize }));
272+
api.use(middlewares.allowCrossDomain);
272273
api.use(middlewares.allowMethodOverride);
274+
api.use(middlewares.handleParseHeaders);
273275

274276
let routers = [
275277
new ClassesRouter(),
@@ -295,9 +297,7 @@ class ParseServer {
295297
}, []);
296298

297299
let appRouter = new PromiseRouter(routes, appId);
298-
appRouter.use(middlewares.allowCrossDomain);
299-
appRouter.use(middlewares.handleParseHeaders);
300-
300+
301301
batch.mountOnto(appRouter);
302302

303303
api.use(appRouter.expressRouter());

src/PromiseRouter.js

+1-7
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)