INNER CODE UNIT · TypeScript
initExpressGraphql
Datlyfe/jira_clone · packages/api/src/index.ts:41
const initExpressGraphql = async () => {
const schema = await buildSchema({
resolvers: RESOLVERS,
validate: { forbidUnknownValues: false },
}).catch((err) => console.log(err));
if (!schema) {
throw new Error("Could not build graphql schema");
}
const app = Express();
const httpServer = http.createServer(app);
const gqlServer = new ApolloServer({
schema,
formatError,
plugins: [
ApolloServerPluginDrainHttpServer({ httpServer }),