June 2025
Intermediate to advanced
837 pages
24h 50m
English
The integration of GraphQL is done via regular middleware, which means you can combine it with other middleware software such as a logger or even authentication. All you need to do for this is to secure the /graphql route. In our example, you use the express-jwt package to secure the interface like you did with the REST interface. Listing 11.13 shows how you can include it in the index.js file.
import express from 'express';import morgan from 'morgan';import expressJwt from 'express-jwt';import swaggerUi from 'swagger-ui-express';import { router as movieRouter } from './movie/index.js';import { router as loginRouter } from './auth.js';import swaggerSpec from './swagger.js';import graphql from ...
Read now
Unlock full access