Express is a popular node.js web server library. Mocks loaded into a
GraphQLHandler can be integrated with express, via
@graphql-mocks/network-express, to provide a live running server. This is useful when needing a live endpoint to test against or hosting mocks to share with others.
@graphql-mocks/network-express npm packages.
This example sets up a file
server.js using an express server with the
expressMiddleware as an application-middleware, listening on port 8080.
Start the express app.
The server will now be responding to graphql
POST requests at
For example, making a request using fetch (in the browser or via
See the GraphQL docs for details on these body parameters, and making http requests.
The express request and response objects are available on the resolver
context argument, under the
See the API Documentation for types and more details.