-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtodoApp.js
More file actions
39 lines (27 loc) · 873 Bytes
/
todoApp.js
File metadata and controls
39 lines (27 loc) · 873 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
var express = require('express');
var mongoose = require('mongoose');
var todoController = require('./controllers/todoController');
var app = express();
// setup template engine
app.set('view engine', 'ejs');
// static files
// localhost:80/assets/style.css
app.use(express.static('./public'));
// mongoose connect
// mongodb://<dbuser>:<dbpassword>@ds147454.mlab.com:47454/todos
// mongoose.connect('mongodb://test:test@ds147454.mlab.com:47454/todos');
//
// var todoSchema = new mongoose.Schema({
// item: String
// });
//
// var Todo = mongoose.model('Todo', todoSchema);
// var itemOne = Todo({item: 'NodeJS MongoDB High Scalability'}).save(function (err) {
// if(err) throw err;
// console.log('Item Saved');
// });
// Fire Controllers
todoController(app);
// listening port 8888
app.listen(8888);
console.log('You are listening to port 8888');