Skip to content

Broken NestJs middleware #20

Open
Open
@jgr3go

Description

@jgr3go

Using NestJs Middleware Consumers is broken with this module. I'm trying to globally add middleware to the admin module with something like:

@Module({
   imports: [
     // whatever
     AdminModule.createAdmin({ 
       adminBroOptions: {
         rootPath: 'admin',
         // etc
       }
     })
  ]
})
export class AppModule implements NestModule {
  confgure(consumer: MiddlewareConsumer) {
     consumer.apply(passport.authenticate('jwt').forRoutes({path: 'admin*', method: RequestMethod.ALL});
  }
}

But the middleware is never executed. I'm reasonably sure this is due to the middleware reordering in express.loader.ts because when I comment it out, the middleware is executed as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions