Dexter Jin

Experiments09 Updated

......@@ -9,21 +9,26 @@ app.use(bodyParser.json());
var books = new Array();
app.get('/book/:bookId', function (req, res) {
// Get book information
var bookId = req.params.bookId;
console.log(books[bookId]);
res.send(books[bookId]);
});
app.post('/book', function (req, res) {
// Create book information
books[req.body.id] = [req.body.id, req.body.name, req.body.price, req.body.author];
})
app.put('/book/:bookId', function (req, res) {
// Update book information
})
app.post('/book', function (req, res) {
// Create book information
})
app.delete('/book/:bookId', function (req, res) {
// Delete book information
})
var server = app.listen(23023);
var server = app.listen(80);
console.log(books);
......
......@@ -38,4 +38,4 @@ app.get('/user/:userId', auth,function (req, res) {
// get User Information
res.send("OK");
});
var server = app.listen(23023);
var server = app.listen(80);
......