-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: support graphql in request interceptor #14
Conversation
@@ -10,7 +13,14 @@ import { AppController } from './app.controller'; | |||
excludeReqPath: '/health', | |||
shortBodyLength: 100, | |||
}), | |||
GraphQLModule.forRoot<ApolloDriverConfig>({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was having a question on what is the best place to define and import the GraplqlModule?
I was defining it in the CommonModule like what we do for CouchbaseModule
, and then import this Module in the other modules that need it. Should we do the same here instead of directly define its initialization on the AppModule?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can move the discussion to the original issue https://github.com/Wiredcraft/nestjs-boilerplate/issues/192
as a test setup, I prefer to keep it slim: register graphql module, controller and resolver in app module.
src/logger.interceptor.ts
Outdated
const url = req.url; | ||
const route = req.route.path; | ||
const url = req.originalUrl; | ||
const route = context.getType() === 'http' ? req.route.path : req.baseUrl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
context.getType()
repeats multiple times, is it better to separate the extracting req
/res
from the context
into another place so that intercept
only takes care higher level logging tasks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved extracting req / res in a function in a new commit.
I'm not quite familiar with GraphQL, do we have an alignment about what to log for a GraphQL request? |
Currently logs same fields as restful request, |
hold on until we have some progress about https://github.com/Wiredcraft/nestjs-boilerplate/issues/192#issuecomment-1523184902. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the logging format of graphql request body can be optimized with other PRs.
c1e3f5d
to
93a573a
Compare
in short term, use |
Description
Issue ticket number and link
https://github.com/Wiredcraft/nestjs-boilerplate/issues/192