Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created October 8, 2020 10:50
Show Gist options
  • Save velotiotech/0cfa098b7a7ab8898da707d1fd29d1f7 to your computer and use it in GitHub Desktop.
Save velotiotech/0cfa098b7a7ab8898da707d1fd29d1f7 to your computer and use it in GitHub Desktop.
import * as path from 'path';
import * as fs from 'fs';
import { ApolloServer } from 'apollo-server'
import { makeExecutableSchema } from 'graphql-tools';
import { resolvers } from './src/resolvers';
const userSchema = path.join(__dirname, 'src/user/user.schema.graphql');
const schemaDef = fs.readFileSync(userSchema, 'utf8');
const schema = makeExecutableSchema({ typeDefs: schemaDef });
const server = new ApolloServer({ schema, resolvers });
server.listen().then(({ url }) => {
console.log(`🚀 Server ready at ${url}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment