This commit is contained in:
Florian Bouillon 2020-07-03 10:51:44 +02:00
parent a634564595
commit ad05c139ed
2 changed files with 23 additions and 0 deletions

View File

@ -7,4 +7,8 @@ module.exports = class ApiController {
all(req, res) { all(req, res) {
res.send(this.db.getAll()) res.send(this.db.getAll())
} }
single(req, res) {
res.send(this.db.getByID(req.query.id))
}
} }

19
test.js Normal file
View File

@ -0,0 +1,19 @@
this.test = 'pouet'
console.log(this.test) // retourne 'pouet'
const fn2 = function() {
console.log(this.test) // retourne undefined
this.pokemon = 'go'
}
fn2()
console.log(this.pokemon)
const fn = () => {
console.log(this.test) // retourne 'pouet'
this.pokemon = 'go'
}
fn()
console.log(this.pokemon)