routing-controllers icon indicating copy to clipboard operation
routing-controllers copied to clipboard

Controller Use before middleware except for particular method

Open codetestmg opened this issue 2 years ago • 0 comments

@Controller()
@UseBefore(UserMiddleware)
@UseAfter(AdminMiddleware)
export class AdminController {


    @Get('/users')
    @UseBefore(ActionMiddleware)
    getAll() {
        console.log("Admin controller ");
        return 'This action returns all admin user';
    }

Is it possible to skip the execution of middleware for a particular method in class?

For example, suppose I want to skip auth check for the login page.

Like laravel framework middleware


  $this->middleware('guest', ['except' => [
            'login', 'handleFacebookCallback', 'handleFacebookUnlink'
        ]]);

codetestmg avatar Nov 30 '21 17:11 codetestmg