Skip to content

Instantly share code, notes, and snippets.

@daniele-zurico
Last active June 5, 2018 11:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daniele-zurico/7089cd76786961975a68e090398232db to your computer and use it in GitHub Desktop.
Save daniele-zurico/7089cd76786961975a68e090398232db to your computer and use it in GitHub Desktop.
const MONGO_PORT = 27017;
const MONGO_URL = "localhost";
const dbName = "graphExample";
// help to debug mongoose
mongoose.set("debug", true);
mongoose.connect(`mongodb://${MONGO_URL}:${MONGO_PORT}/${dbName}`);
const app = express();
const schema: GraphQLSchema = mergeSchemas({
schemas,
resolvers
});
// GraphQL
const server = new ApolloServer({
schema,
context: async (req: any) => {
// If we want to put some restriction
}
});
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