mirror of
https://github.com/FranP-code/countries.git
synced 2025-10-13 00:02:15 +00:00
Only custom landing page in prod
This commit is contained in:
16
index.js
16
index.js
@@ -5,16 +5,22 @@ import {readFileSync} from 'fs';
|
|||||||
import {resolvers} from './resolvers.js';
|
import {resolvers} from './resolvers.js';
|
||||||
|
|
||||||
const typeDefs = gql(readFileSync('./schema.graphql', 'utf-8'));
|
const typeDefs = gql(readFileSync('./schema.graphql', 'utf-8'));
|
||||||
|
const schema = buildSubgraphSchema({typeDefs, resolvers});
|
||||||
|
|
||||||
const server = new ApolloServer({
|
let plugins;
|
||||||
schema: buildSubgraphSchema({typeDefs, resolvers}),
|
if (process.env.NODE_ENV === 'production') {
|
||||||
introspection: true,
|
plugins = [
|
||||||
plugins: [
|
|
||||||
ApolloServerPluginLandingPageProductionDefault({
|
ApolloServerPluginLandingPageProductionDefault({
|
||||||
footer: false,
|
footer: false,
|
||||||
graphRef: process.env.APOLLO_GRAPH_REF
|
graphRef: process.env.APOLLO_GRAPH_REF
|
||||||
})
|
})
|
||||||
]
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
const server = new ApolloServer({
|
||||||
|
schema,
|
||||||
|
introspection: true,
|
||||||
|
plugins
|
||||||
});
|
});
|
||||||
|
|
||||||
server.listen({port: process.env.PORT || 4000}).then(({url}) => {
|
server.listen({port: process.env.PORT || 4000}).then(({url}) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user