mirror of
https://github.com/FranP-code/countries.git
synced 2025-10-13 00:02:15 +00:00
Make the schema into a subgraph
This commit is contained in:
11
index.js
11
index.js
@@ -1,9 +1,12 @@
|
||||
import {ApolloServer} from 'apollo-server';
|
||||
import {resolvers, typeDefs} from './schema.js';
|
||||
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({
|
||||
typeDefs,
|
||||
resolvers,
|
||||
schema: buildSubgraphSchema({typeDefs, resolvers}),
|
||||
introspection: true,
|
||||
playground: true
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user