server/router/search.js

18 lines
453 B
JavaScript
Raw Permalink Normal View History

2023-02-08 12:30:56 +01:00
console.log("router/search INIT");
var express = require("express");
var server = require("../server");
var database = require("../services/database");
var passport = server.passport;
var router = new express.Router();
router
.route("/:term")
.get(passport.authenticate("jwt", { session: false }), (req, res) => {
database.search(req.params.term.toLowerCase(), result => {
res.json(result).end();
});
});
module.exports = router;