From ad05c139edd7dfbdf07ae0bc253b66a18f5d99ea Mon Sep 17 00:00:00 2001 From: Florian Bouillon Date: Fri, 3 Jul 2020 10:51:44 +0200 Subject: [PATCH] Fait --- Controller/ApiController.js | 4 ++++ test.js | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 test.js diff --git a/Controller/ApiController.js b/Controller/ApiController.js index e3f8bd6..bc16d2a 100644 --- a/Controller/ApiController.js +++ b/Controller/ApiController.js @@ -7,4 +7,8 @@ module.exports = class ApiController { all(req, res) { res.send(this.db.getAll()) } + + single(req, res) { + res.send(this.db.getByID(req.query.id)) + } } \ No newline at end of file diff --git a/test.js b/test.js new file mode 100644 index 0000000..6156a98 --- /dev/null +++ b/test.js @@ -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)