Created
September 10, 2019 09:45
-
-
Save tkssharma/947e6602a29a7ed7ff77d74d7f87c14a 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
const server = new ApolloServer({ | |
typeDefs, | |
resolvers, | |
context: ({ req }) => ({ | |
dbContext: new Database(global.connection), | |
me: getLoggedInUser(req), | |
}), | |
}); | |
server.applyMiddleware({ app }); | |
if (!module.parent) { | |
eventEmitter.on('dbReady', connection => { | |
// global.connection = connection; | |
app.listen({ port: process.env.PORT || 3000 }, () => | |
// eslint-disable-next-line no-console | |
console.log(`π π π π Server ready at http://localhost:3000${server.graphqlPath} π π π `), | |
); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment