Created
September 14, 2021 05:25
-
-
Save hamzaajaved/5d0c57c7115f6fdabf49ea1a04fde026 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
| mongoose.connect('mongodb://localhost:27017/my-app', { | |
| useNewUrlParser: true, | |
| useCreateIndex: true, | |
| useUnifiedTopology: true | |
| }); | |
| const db = mongoose.connection; | |
| db.on("error", console.error.bind(console, "connection error:")); | |
| db.once("open", () => { | |
| console.log("Database connected"); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment