mirror of
https://github.com/FranP-code/countries.git
synced 2025-10-13 00:02:15 +00:00
16 lines
477 B
JavaScript
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}`);
|
|
});
|