Added a search page
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
Gregory Ballantine 2024-05-21 10:22:44 -04:00
parent 43e70e243c
commit 3e88dab7da
2 changed files with 3 additions and 1 deletions

View File

@ -52,6 +52,7 @@ app.use(express.static('public'));
const homeRoutes = require('./src/routes/home'); const homeRoutes = require('./src/routes/home');
const itemRoutes = require('./src/routes/item'); const itemRoutes = require('./src/routes/item');
const licenseRoutes = require('./src/routes/license'); const licenseRoutes = require('./src/routes/license');
const searchRoutes = require('./src/routes/search');
// register route handlers // register route handlers
app.get('/', homeRoutes.getIndex); app.get('/', homeRoutes.getIndex);
@ -65,6 +66,7 @@ app.post('/license/add', licenseRoutes.postAdd);
app.get('/license/:id', licenseRoutes.getLicense); app.get('/license/:id', licenseRoutes.getLicense);
app.get('/license/:id/edit', licenseRoutes.getEdit); app.get('/license/:id/edit', licenseRoutes.getEdit);
app.post('/license/:id/edit', licenseRoutes.postEdit); app.post('/license/:id/edit', licenseRoutes.postEdit);
app.get('/search', searchRoutes.getSearch);
// start app // start app
app.listen(config.get('server.port'), config.get('server.address'), () => { app.listen(config.get('server.port'), config.get('server.address'), () => {

View File

@ -3,7 +3,7 @@ const Item = db.items;
const License = db.licenses; const License = db.licenses;
// GET - /search // GET - /search
exports.getIndex = async function(req, res) { exports.getSearch = async function(req, res) {
// decode URL search query // decode URL search query
let query = req.params.query; let query = req.params.query;