[Server] Send HTTP response after processing request.
This commit is contained in:
Родитель
45a553fa14
Коммит
7ec8eda32a
|
@ -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) => {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче