From dad891f9d7f060c5d2f4c9f47c410730aa48d5df Mon Sep 17 00:00:00 2001 From: Rafael Marçalo Date: Fri, 21 Oct 2022 02:00:10 +0100 Subject: Added initially developed files --- routes/home.js | 8 ++++++++ routes/info.js | 8 ++++++++ routes/search.js | 13 +++++++++++++ routes/settings.js | 8 ++++++++ 4 files changed, 37 insertions(+) create mode 100644 routes/home.js create mode 100644 routes/info.js create mode 100644 routes/search.js create mode 100644 routes/settings.js (limited to 'routes') diff --git a/routes/home.js b/routes/home.js new file mode 100644 index 0000000..98e086b --- /dev/null +++ b/routes/home.js @@ -0,0 +1,8 @@ +"use strict"; + +function home(req, res) +{ + res.render('index'); +}; + +module.exports = home; \ No newline at end of file diff --git a/routes/info.js b/routes/info.js new file mode 100644 index 0000000..61b2c87 --- /dev/null +++ b/routes/info.js @@ -0,0 +1,8 @@ +"use strict"; + +function info(req, res) +{ + res.render('info'); +}; + +module.exports = info; \ No newline at end of file diff --git a/routes/search.js b/routes/search.js new file mode 100644 index 0000000..4ef050c --- /dev/null +++ b/routes/search.js @@ -0,0 +1,13 @@ +"use strict"; + +const apibay = require('../server/js/apibay'); +const template = require('../server/js/template'); + +async function search(req, res) +{ + let query = req.body.search; + let results = await apibay.hit(query); + res.render('result', {query: query, results: results, functions: template}); +}; + +module.exports = search; \ No newline at end of file diff --git a/routes/settings.js b/routes/settings.js new file mode 100644 index 0000000..be6a899 --- /dev/null +++ b/routes/settings.js @@ -0,0 +1,8 @@ +"use strict"; + +function settings(req, res) +{ + res.render('settings'); +}; + +module.exports = settings; \ No newline at end of file -- cgit v1.2.3