The Guild LogoThe Guild Monogram

Search docs

Search icon

Products by The Guild


Hive logoHive blurred logo


Schema Registry for your GraphQL Workflows

Skip to main content

Custom Server

By default, GraphQL Mesh provides you an HTTP server. You can see the details in Mesh as Gateway page. However, you can replace GraphQL Mesh's default server implementation by a custom one.

How to do?#

The following example shows how to replace GraphQL Mesh's default server implementation with Apollo Server;


const { ApolloServer } = require('apollo-server');
module.exports = async ({ getBuiltMesh, documents, logger }) => {
const { schema } = await getBuiltMesh();
const apolloServer = new ApolloServer({
context: ({ req }) => req,
playground: {
tabs:{ location, rawSDL }) => ({
name: location,
endpoint: '/graphql',
query: rawSDL,
const { url } = await apolloServer.listen(4000);`🚀 Server ready at ${url}`);

Then add the following line to your configuration file;

customServerHandler: ./myServerHandler.js

When you use custom server handler, you won't be able to use configuration options under serve!