Skip to content

Commit 3458880

Browse files
committed
complete api
1 parent 9f2db71 commit 3458880

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

Lecture14/sequelizetest/db.sqlite

0 Bytes
Binary file not shown.

Lecture14/sequelizetest/index.js

+22
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,28 @@ app.post('/', (req, res) => {
5050
})
5151
})
5252

53+
app.patch('/:id', (req, res) => {
54+
Bands.update(req.body, {
55+
where: {
56+
id: req.params.id
57+
}
58+
}).then(() => {
59+
res.sendStatus(204)
60+
})
61+
})
62+
63+
app.delete('/', (req, res) => {
64+
Bands.destroy({
65+
where: {
66+
striked: true
67+
}
68+
}).then(() => {
69+
res.sendStatus(204)
70+
}).catch(err => {
71+
console.log(err)
72+
res.sendStatus(500)
73+
})
74+
})
5375

5476

5577
Bands.sync().then(() => {

0 commit comments

Comments
 (0)