From 3e88dab7da46926b21cf4931843311543bcaad4d Mon Sep 17 00:00:00 2001 From: Gregory Ballantine Date: Tue, 21 May 2024 10:22:44 -0400 Subject: [PATCH] Added a search page --- index.js | 2 ++ src/routes/search.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 3778201..191ff2e 100644 --- a/index.js +++ b/index.js @@ -52,6 +52,7 @@ app.use(express.static('public')); const homeRoutes = require('./src/routes/home'); const itemRoutes = require('./src/routes/item'); const licenseRoutes = require('./src/routes/license'); +const searchRoutes = require('./src/routes/search'); // register route handlers app.get('/', homeRoutes.getIndex); @@ -65,6 +66,7 @@ app.post('/license/add', licenseRoutes.postAdd); app.get('/license/:id', licenseRoutes.getLicense); app.get('/license/:id/edit', licenseRoutes.getEdit); app.post('/license/:id/edit', licenseRoutes.postEdit); +app.get('/search', searchRoutes.getSearch); // start app app.listen(config.get('server.port'), config.get('server.address'), () => { diff --git a/src/routes/search.js b/src/routes/search.js index 8c41bd7..83b1530 100644 --- a/src/routes/search.js +++ b/src/routes/search.js @@ -3,7 +3,7 @@ const Item = db.items; const License = db.licenses; // GET - /search -exports.getIndex = async function(req, res) { +exports.getSearch = async function(req, res) { // decode URL search query let query = req.params.query;