-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
37 lines (34 loc) · 1.1 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { ApolloServer } from '@apollo/server';
import { ApolloServerPluginLandingPageProductionDefault } from '@apollo/server/plugin/landingPage/default';
import { startStandaloneServer } from '@apollo/server/standalone';
import { resolvers, typeDefs } from './src/controller/graphql/schema.js';
const server = new ApolloServer({
typeDefs,
resolvers,
introspection: true,
status400ForVariableCoercionErrors: true,
formatError: (error) => {
console.error(error);
return {
message: error.message,
};
},
plugins: [ApolloServerPluginLandingPageProductionDefault(
{
embed: {
displayOptions: {
runTelemetry: true,
docsPanelState: 'open',
showHeadersAndEnvVars: true,
},
},
},
)],
});
const port = process.env.PORT || 8080;
const { url } = await startStandaloneServer(server, {
listen: { port: port },
});
console.log(`🚀 Server ready at: ${url}`);
server.keepAliveTimeout = 120 * 1000;
server.headersTimeout = 120 * 1000;