Skip to content

Instantly share code, notes, and snippets.

@LazyFatArrow LazyFatArrow/index.js

Last active Mar 9, 2019
What would you like to do?
import "@babel/polyfill";
import mongoose from 'mongoose'
import { resolve } from 'path'
import { mergeTypes, fileLoader } from 'merge-graphql-schemas';
import { ApolloServer, gql } from 'apollo-server'
import resolvers from './resolvers'
const schema = mergeTypes(
fileLoader(resolve(__dirname, './schema'))
const apolloOptions = {
typeDefs: gql(schema),
mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true })
.then(() => {
return new ApolloServer(apolloOptions).listen(
.then(({ url, subscriptionsUrl }) => {
console.log(`🚀 Server ready at ${url}`);
console.log(`🚀 Subscriptions ready at ${subscriptionsUrl}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.