graphql/yoga-server/tutorial/basic/03-graphql-server #949
Replies: 2 comments 2 replies
-
how would I rewrite this with yogaV2 if GraphQLServer is removed: I used yoga's built-in express server to access the request data to get the cookie to verify. (middleware) Now I can't seem to check it like the code below. I'm using yoga and Prisma V2 const { GraphQLServer } = require("graphql-yoga");
const server = createServer();
server.express.use(cookieParser());
server.express.use((req: any, res: any, next: any) => {
const { token } = req.cookies;
if (token) {
const { userId } = jwt.verify(token, process.env.APP_SECRET)
req.userId = userId
}
next()
})
server.start(
{
cors: {
credentials: true,
origin: [process.env.FRONTEND_ENDPOINT],
},
},
(deets: { port: string }) => {
console.log(`Server is now running on port http://localhost:${deets.port}`);
}
); |
Beta Was this translation helpful? Give feedback.
1 reply
-
where is the other transport implementations that article said at the beginning of the page? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
graphql/yoga-server/tutorial/basic/03-graphql-server
Guild Docs Example
https://www.the-guild.dev/graphql/yoga-server/tutorial/basic/03-graphql-server
Beta Was this translation helpful? Give feedback.
All reactions