Created
December 29, 2018 22:58
-
-
Save JeffML/bcc4bf030a7bc0907a95a5eb43125931 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import express from 'express'; | |
import { ApolloServer } from 'apollo-server-express'; | |
import http from 'http'; | |
import { typeDefs } from './schema'; | |
import resolvers from './resolvers'; | |
const PORT = 3031; | |
const app = express(); | |
const server = new ApolloServer({ | |
typeDefs, | |
resolvers, | |
}); | |
server.applyMiddleware({ | |
app | |
}); | |
const httpServer = http.createServer(app); | |
server.installSubscriptionHandlers(httpServer); | |
httpServer.listen(PORT, () => { | |
console.log(`๐ Server ready at http://localhost:${PORT}${server.graphqlPath}`); | |
console.log(`๐ Subscriptions ready at ws://localhost:${PORT}${server.subscriptionsPath}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment