edit box name/desc
This commit is contained in:
+7
-1
@@ -55,7 +55,13 @@ app.post('/box', async (request, response) => {
|
||||
const updatedBoxes = await getAllBoxes();
|
||||
response.send(updatedBoxes);
|
||||
});
|
||||
|
||||
//edit box
|
||||
app.put('/box/:id', async (request, response) => {
|
||||
const id = request.params.id;
|
||||
await Box.updateOne({_id: id},{ $set: request.body});
|
||||
const updatedBoxes = await getAllBoxes();
|
||||
response.send(updatedBoxes);
|
||||
});
|
||||
//delete box
|
||||
app.delete('/box/:id', async (request, response) => {
|
||||
await Box.deleteOne({_id: request.params.id});
|
||||
|
||||
Reference in New Issue
Block a user