Skip to content

Commit

Permalink
chore: Disable apollo explorer (powerhouse-inc#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
valiafetisov authored Apr 5, 2023
1 parent 25baa4e commit 14b4e28
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions api/src/graphql/server.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { Server } from 'http';
import { createServer as createHttpServer } from 'http';
import { ApolloServerPlugin, ApolloServer } from '@apollo/server';
import type express from 'express';
import { ApolloServerPlugin, ApolloServer } from '@apollo/server';
import { expressMiddleware } from '@apollo/server/express4';
import { ApolloServerPluginLandingPageDisabled } from '@apollo/server/plugin/disabled';
import bodyParser from 'body-parser';
import cors from 'cors';
import { PORT } from '../env';
Expand All @@ -29,7 +30,7 @@ function loggerPlugin(): ApolloServerPlugin<Context> {
const createApolloServer = (): ApolloServer<Context> => new ApolloServer<Context>({
schema: schemaWithMiddleware,
introspection: true,
plugins: [loggerPlugin()],
plugins: [ApolloServerPluginLandingPageDisabled(), loggerPlugin()],
});

export const startServer = async (
Expand All @@ -40,7 +41,7 @@ export const startServer = async (
const apollo = createApolloServer();

await apollo.start();
app.use('/', cors<cors.CorsRequest>(), bodyParser.json(), expressMiddleware(apollo, {
app.use('/graphql', cors<cors.CorsRequest>(), bodyParser.json(), expressMiddleware(apollo, {
context: async (params) => (createContext(params)),
}));

Expand Down

0 comments on commit 14b4e28

Please sign in to comment.