Created
April 25, 2020 12:22
-
-
Save piyushgarg-dev/ddf9cd46e7f14c55a99daba79249becd 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 express = require('express'); | |
| const mongoose = require('mongoose'); | |
| const app = express() | |
| mongoose.connect( | |
| `mongodb+srv://piyushgarg:hello123@cluster0-2bghc.mongodb.net/test?retryWrites=true&w=majority` | |
| ) | |
| .then(() => console.log('MongoDB Connect')) | |
| .catch((err) => console.log(`Error Occured ${err}`)) | |
| app.get('/', (req, res) => { | |
| res.send('Welcome to my API'); | |
| }) | |
| app.listen(9000, () => console.log('Server Started at PORT 9000')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment