[Server] Send HTTP response after processing request.

This commit is contained in:
JD Huntington 2019-02-25 12:11:40 -08:00
Родитель 45a553fa14
Коммит 7ec8eda32a
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -40,16 +40,19 @@ app.put('/todos/:id', (req, res) => {
app.post('/todos/:id', (req, res) => { app.post('/todos/:id', (req, res) => {
store.todos[req.params.id] = req.body; store.todos[req.params.id] = req.body;
store.save(); store.save();
res.json('ok');
}); });
app.delete('/todos/:id', (req, res) => { app.delete('/todos/:id', (req, res) => {
delete store.todos[req.params.id]; delete store.todos[req.params.id];
store.save(); store.save();
res.json('ok');
}); });
app.post('/todos', req => { app.post('/todos', (req, res) => {
store.todos = req.body; store.todos = req.body;
store.save(); store.save();
res.json('ok');
}); });
app.get('/hello', (req, res) => { app.get('/hello', (req, res) => {