-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
24 lines (20 loc) · 680 Bytes
/
Copy pathapp.js
File metadata and controls
24 lines (20 loc) · 680 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
var todoList = require("./routes/todo-list");
var storeService = require("./modules/list-store").getStore();
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
app.use(express.static('dist'));
app.use(express.static('node_modules'));
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }));
// parse application/json
app.use(bodyParser.json());
app.get('/todolist', function(req, res) {
storeService.fetch(req, res);
});
app.post('/todolist', function(req, res) {
//console.log(req.body);
storeService.save(req, res);
});
app.listen(3001);
console.log("Server listening on port 3001");