mirror of
https://github.com/Aviortheking/IMIE_CQ.git
synced 2025-04-23 03:12:09 +00:00
18 lines
290 B
JavaScript
18 lines
290 B
JavaScript
module.exports = class ApiController {
|
|
|
|
constructor(db) {
|
|
this.db = db
|
|
}
|
|
|
|
all(req, res) {
|
|
res.send(this.db.getAll())
|
|
}
|
|
|
|
single(req, res) {
|
|
if (req.query.id === '') {
|
|
res.send({ message: 'Identifiant incorrect' })
|
|
} else {
|
|
res.send(this.db.getByID(req.query.id))
|
|
}
|
|
}
|
|
} |