File tree 2 files changed +4
-10
lines changed
2 files changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -269,7 +269,9 @@ class ParseServer {
269
269
api . use ( '/' , bodyParser . urlencoded ( { extended : false } ) , new PublicAPIRouter ( ) . expressRouter ( ) ) ;
270
270
271
271
api . use ( bodyParser . json ( { 'type' : '*/*' , limit : maxUploadSize } ) ) ;
272
+ api . use ( middlewares . allowCrossDomain ) ;
272
273
api . use ( middlewares . allowMethodOverride ) ;
274
+ api . use ( middlewares . handleParseHeaders ) ;
273
275
274
276
let routers = [
275
277
new ClassesRouter ( ) ,
@@ -295,9 +297,7 @@ class ParseServer {
295
297
} , [ ] ) ;
296
298
297
299
let appRouter = new PromiseRouter ( routes , appId ) ;
298
- appRouter . use ( middlewares . allowCrossDomain ) ;
299
- appRouter . use ( middlewares . handleParseHeaders ) ;
300
-
300
+
301
301
batch . mountOnto ( appRouter ) ;
302
302
303
303
api . use ( appRouter . expressRouter ( ) ) ;
Original file line number Diff line number Diff line change @@ -23,7 +23,6 @@ export default class PromiseRouter {
23
23
// location: optional. a location header
24
24
constructor ( routes = [ ] , appId ) {
25
25
this . routes = routes ;
26
- this . middlewares = [ ] ;
27
26
this . appId = appId ;
28
27
this . mountRoutes ( ) ;
29
28
}
@@ -39,10 +38,6 @@ export default class PromiseRouter {
39
38
}
40
39
} ;
41
40
42
- use ( middleware ) {
43
- this . middlewares . push ( middleware ) ;
44
- }
45
-
46
41
route ( method , path , ...handlers ) {
47
42
switch ( method ) {
48
43
case 'POST' :
@@ -115,8 +110,7 @@ export default class PromiseRouter {
115
110
this . routes . forEach ( ( route ) => {
116
111
let method = route . method . toLowerCase ( ) ;
117
112
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 ) ;
120
114
} ) ;
121
115
return expressApp ;
122
116
} ;
You can’t perform that action at this time.
0 commit comments