From d64946daae7653befc0f192389ed41eed2aa2f35 Mon Sep 17 00:00:00 2001 From: Sectimus Date: Sun, 15 Dec 2019 02:26:04 +0000 Subject: [PATCH] added extra endpoints for more advanced filtering --- routes/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/routes/index.js b/routes/index.js index 2d00046..26d7fad 100644 --- a/routes/index.js +++ b/routes/index.js @@ -291,4 +291,20 @@ router.get("/sessions", function(req, res) { res.send(sessions); }); +//get session by id +router.get("/sessions/:id", function(req, res) { + var id = req.params["id"]; + var session = sessions.find(x => x.id == id); + res.status(200); + res.send(session); +}); + +//get talks by sessionid +router.get("/talks/session/:id", function(req, res) { + var id = req.params["id"]; + var talksArray = talks.filter(x => x.session == id); + res.status(200); + res.send(talksArray); +}); + module.exports = router;