-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
24 lines (17 loc) · 694 Bytes
/
server.js
File metadata and controls
24 lines (17 loc) · 694 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const express = require('express');
const app = express();
const port = process.env.PORT || 3000;
const mongoose = require('mongoose');
const Task = require('./api/models/todoListModel');
const bodyParser = require('body-parser');
mongoose.Promise = global.Promise;
const dbUsername = `test`;
const dbPassword = `test`;
const dbName = 'test-nodetodo';
mongoose.connect(`mongodb://${dbUsername}:${dbPassword}@ds163053.mlab.com:63053/${dbName}`);
app.use(bodyParser.urlencoded({extended : true}));
app.use(bodyParser.json());
var routes = require('./api/routes/todoListRoutes'); //importing route
routes(app); //register the route
app.listen(port);
console.log("Listening PORT : " + port);