server/router/search.js
Artem Anufrij cff48aaada
All checks were successful
continuous-integration/drone Build is passing
move
2023-02-08 12:30:56 +01:00

18 lines
453 B
JavaScript

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;