File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import { NestMiddleware } from '../../../src/common/interfaces/middlewares/nest-
77export class AuthMiddleware implements NestMiddleware {
88 constructor ( private usersService : UsersService ) { }
99
10- public resolve ( ) {
10+ public resolve ( ) : ( req , res , next ) => void {
1111 return ( req , res , next ) => {
1212 const username = req . headers [ 'x-access-token' ] ;
1313 const users = this . usersService . getUsers ( ) ;
@@ -19,6 +19,5 @@ export class AuthMiddleware implements NestMiddleware {
1919 next ( ) ;
2020 } ;
2121 }
22-
2322}
2423
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export class RoutesMapper {
1616 }
1717 const paths = this . routerExplorer . scanForPaths ( Object . create ( routeMetatype ) , routeMetatype . prototype ) ;
1818 return paths . map ( ( route ) => ( {
19- path : this . validateRoutePath ( routePath ) + this . validateRoutePath ( route . path ) ,
19+ path : this . validateGlobalPath ( routePath ) + this . validateRoutePath ( route . path ) ,
2020 method : route . requestMethod ,
2121 } ) ) ;
2222 }
@@ -32,6 +32,11 @@ export class RoutesMapper {
3232 } ;
3333 }
3434
35+ private validateGlobalPath ( path : string ) : string {
36+ const prefix = validatePath ( path ) ;
37+ return prefix === '/' ? '' : prefix ;
38+ }
39+
3540 private validateRoutePath ( path : string ) : string {
3641 return validatePath ( path ) ;
3742 }
You can’t perform that action at this time.
0 commit comments