Last active
September 26, 2019 15:37
-
-
Save donjosef/afbf9c531cf40fac18f40e33a7134df0 to your computer and use it in GitHub Desktop.
Connect to database
This file contains 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 mongoose = require('mongoose'); | |
//connect our server to database created with atlas | |
//Be sure to type this at the very bottom of the file, AFTER all the app.use() | |
mongoose | |
.connect('mongodb+srv://giuseppe:<password>@cluster0-rchmx.mongodb.net/test?retryWrites=true&w=majority') | |
.then(() => { | |
app.listen(8080, () => { | |
console.log('Server listening on port 8080...') | |
}) | |
}) | |
.catch(err => console.log('Error with mongoose connection', err)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment