Files
countries/index.js
2022-02-11 11:48:06 -08:00

16 lines
477 B
JavaScript

import {ApolloServer, gql} from 'apollo-server';
import {buildSubgraphSchema} from '@apollo/subgraph';
import {readFileSync} from 'fs';
import {resolvers} from './resolvers.js';
const typeDefs = gql(readFileSync('./schema.graphql', 'utf-8'));
const server = new ApolloServer({
schema: buildSubgraphSchema({typeDefs, resolvers}),
introspection: true
});
server.listen({port: process.env.PORT || 4000}).then(({url}) => {
console.log(`🚀 Server ready at ${url}`);
});