-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes-todo.js
41 lines (34 loc) · 1.31 KB
/
routes-todo.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
33
34
35
36
37
38
39
40
41
function todoAPI (app) {
// Serving files to http://localhost:PORT
app.get('/', function (req, res) {
res.sendFile(__dirname + '/index.html')
})
app.get('/style.css', function (req, res) {
res.sendFile(__dirname + '/style.css')
})
app.get('/todo.js', function (req, res) {
res.sendFile(__dirname + '/todo.js')
})
// TODO: Make a data object ("database") to store all of the Items
app.get('/all', function (req, res) {
// TODO: **Send client all of the elements inside our ("database")
})
app.post('/item', function (req, res) {
// TODO: Make sure the values in req.body.KEY are present
// TODO: **Create a new Item, add it to the "database"
// TODO: Send the client a "successs" response
})
app.put('/item', function (req, res) {
// TODO: Make sure the values in req.body.KEY are present
// TODO: Check to make sure the item exists in "database"
// TODO: **Update any values in "database" from req.body.KEY
// TODO: Send the client a "success" response
})
app.delete('/item', function (req, res) {
// TODO: Make sure the values in req.body.KEY are present
// TODO: Check to make sure the item exists in "database"
// TODO: **Delete the element from the "databse"
// TODO: Send the client a "success" response
})
}
module.exports = todoAPI