Skip to content

Instantly share code, notes, and snippets.

@hurali97
Created July 20, 2019 13:28
Show Gist options
  • Save hurali97/4716d96c0657a47e50015bc01af5a198 to your computer and use it in GitHub Desktop.
Save hurali97/4716d96c0657a47e50015bc01af5a198 to your computer and use it in GitHub Desktop.
Server
const express = require('express');
const { ApolloServer } = require('apollo-server-express');
const cors = require('cors');
const schema = require('./graphql/schema');
const resolvers = require('./graphql/resolver');
const app = express();
app.use(cors());
const server = new ApolloServer({
typeDefs: schema,
resolvers,
})
server.applyMiddleware({ app, path: '/graphql' });
app.listen({ port: 8000 }, () => {
console.log('Apollo Server on http://localhost:8000/graphql');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment