Created
March 5, 2020 14:38
-
-
Save bogoslavskiy/9cf630cb02adb9485efc286cedd6cd13 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
[...] | |
httpServer.listen({ port: config.port }, () => { | |
console.log(`π Server ready at http://localhost:${config.port}${server.graphqlPath}`) | |
console.log(`π Subscriptions ready at ws://localhost:${config.port}${server.subscriptionsPath}`) | |
const connectMongoWithRetry = () => { | |
mongoose | |
.connect(config.mongoURI, { | |
useNewUrlParser: true, | |
useCreateIndex: true, | |
useUnifiedTopology: true, | |
}) | |
.then(() => console.log(`π MongoDB connection ready at ${config.mongoURI}`)) | |
.catch(err => { | |
console.error('MongoDB connection error', err); | |
setTimeout(connectMongoWithRetry, 5000); | |
}); | |
}; | |
connectMongoWithRetry(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment