alex-ald/postgraphile-nest

NestJS's global interceptors, guards don't execute

Opened this issue · 1 comments

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.

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?