Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NestJS's global interceptors, guards don't execute #36

Open
kuldeep-extentia opened this issue Apr 14, 2022 · 1 comment
Open

NestJS's global interceptors, guards don't execute #36

kuldeep-extentia opened this issue Apr 14, 2022 · 1 comment

Comments

@kuldeep-extentia
Copy link

Hi,
So if i configure postgraphile using the official doc like:

**> `For Nest, this might look something like:

import { Controller, Get, Post, Req, Next, Res } from '@nestjs/common';
import { Request, Response } from 'express';
import { PostGraphileResponseNode } from 'postgraphile';
import { middleware } from './postgraphile.middleware';

@controller('/')
export class PostGraphileController {
@get(middleware.graphiqlRoute)
graphiql (@Req() request: Request, @res() response: Response, @Next() next) {
middleware.graphiqlRouteHandler(new PostGraphileResponseNode(request, response, next));
}

@post(middleware.graphqlRoute)
graphql (@Req() request: Request, @res() response: Response, @Next() next) {
middleware.graphqlRouteHandler(new PostGraphileResponseNode(request, response, next));
}
}`**

All my nestjs global interceptors and guards work.

But when i configure postgraphile using your module's forRoot method, none of my global interceptors/guards get executed. I'm able to execute middlewares configured for /graphql but not interceptors/guards.

Any hint would be helpful. Thank you.

@kuldeep-extentia
Copy link
Author

kuldeep-extentia commented Apr 14, 2022

I realized postgraphile instance is being used as a middleware directly using app.use(postgraphile) and thus interceptors/guards will not run.
Any chance of exposing the postgraphile instance instead of mounting as a middleware?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant