@@ -58,43 +58,43 @@ export class ExpressLoader extends AbstractLoader {
5858 // Nestjs uses bodyParser under the hood which is in conflict with adminjs setup.
5959 // Due to adminjs-expressjs usage of formidable we have to move body parser in layer tree after adminjs init.
6060 // Notice! This is not documented feature of express, so this may change in the future. We have to keep an eye on it.
61- if ( app && app . _router && app . _router . stack ) {
62- const jsonParserIndex = app . _router . stack . findIndex (
61+ if ( app && app . router && app . router . stack ) {
62+ const jsonParserIndex = app . router . stack . findIndex (
6363 ( layer : { name : string } ) => layer . name === 'jsonParser' ,
6464 ) ;
6565 if ( jsonParserIndex >= 0 ) {
66- jsonParser = app . _router . stack . splice ( jsonParserIndex , 1 ) ;
66+ jsonParser = app . router . stack . splice ( jsonParserIndex , 1 ) ;
6767 }
6868
69- const urlencodedParserIndex = app . _router . stack . findIndex (
69+ const urlencodedParserIndex = app . router . stack . findIndex (
7070 ( layer : { name : string } ) => layer . name === 'urlencodedParser' ,
7171 ) ;
7272 if ( urlencodedParserIndex >= 0 ) {
73- urlencodedParser = app . _router . stack . splice ( urlencodedParserIndex , 1 ) ;
73+ urlencodedParser = app . router . stack . splice ( urlencodedParserIndex , 1 ) ;
7474 }
7575
76- const adminIndex = app . _router . stack . findIndex (
76+ const adminIndex = app . router . stack . findIndex (
7777 ( layer : { name : string } ) => layer . name === 'admin' ,
7878 ) ;
7979 if ( adminIndex >= 0 ) {
80- admin = app . _router . stack . splice ( adminIndex , 1 ) ;
80+ admin = app . router . stack . splice ( adminIndex , 1 ) ;
8181 }
8282
8383 // if adminjs-nestjs didn't reorder the middleware
8484 // the body parser would have come after corsMiddleware
85- const corsIndex = app . _router . stack . findIndex (
85+ const corsIndex = app . router . stack . findIndex (
8686 ( layer : { name : string } ) => layer . name === 'corsMiddleware' ,
8787 ) ;
8888
8989 // in other case if there is no corsIndex we go after expressInit, because right after that
9090 // there are nest endpoints.
91- const expressInitIndex = app . _router . stack . findIndex (
91+ const expressInitIndex = app . router . stack . findIndex (
9292 ( layer : { name : string } ) => layer . name === 'expressInit' ,
9393 ) ;
9494
9595 const initIndex = ( corsIndex >= 0 ? corsIndex : expressInitIndex ) + 1 ;
9696
97- app . _router . stack . splice (
97+ app . router . stack . splice (
9898 initIndex ,
9999 0 ,
100100 ...admin ,
0 commit comments