-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
32 lines (23 loc) · 889 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');
const mongoose = require('mongoose');
const app = express();
const port = 1308;
app.use(cors());
app.use(bodyParser.json());
app.get('/', (req, res) => {
res.send(' Knock Knock... Who's there... ITS GRAFITTI TIME B^D ');
});
mongoose.connect('mongodb+srv://ArtistsUnderground_Database:[email protected]/myFirstDatabase?retryWrites=true&w=majority', {
useNewUrlParser: true,
useUnifiedTopology: true
});
const db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', function() {
console.log("HIIII BABY... Guess whose connected...");
});
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`);
});