Skip to content

Commit

Permalink
Step 7.6: Install subscription handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
DAB0mB authored and Urigo committed May 20, 2020
1 parent 3481d1c commit dedd1d0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ApolloServer, gql, PubSub } from 'apollo-server-express';
import cors from 'cors';
import express from 'express';
import http from 'http';
import schema from './schema';

const app = express();
Expand All @@ -23,8 +24,11 @@ server.applyMiddleware({
path: '/graphql',
});

const httpServer = http.createServer(app);
server.installSubscriptionHandlers(httpServer);

const port = process.env.PORT || 4000;

app.listen(port, () => {
httpServer.listen(port, () => {
console.log(`Server is listening on port ${port}`);
});

0 comments on commit dedd1d0

Please sign in to comment.