swjin

json example

...@@ -14,6 +14,14 @@ app.get('/book/:bookId', function (req, res) { ...@@ -14,6 +14,14 @@ app.get('/book/:bookId', function (req, res) {
14 res.send(books[bookId]); 14 res.send(books[bookId]);
15 }); 15 });
16 16
17 +/*
18 +{
19 + "id" : 2,
20 + "name" : "book2",
21 + "price" : 2000,
22 + "author" : "jin"
23 +}
24 +*/
17 app.post('/book', function (req, res) { 25 app.post('/book', function (req, res) {
18 // Create book information 26 // Create book information
19 books[req.body.id] = [req.body.id, req.body.name, req.body.price, req.body.author]; 27 books[req.body.id] = [req.body.id, req.body.name, req.body.price, req.body.author];
......