| | |
| | | |
| | | const searchLib = require("./lib/search") |
| | | searchLib.doIndex().catch(console.error) |
| | | fastify.get("/api/search/user", async function (req, res) { |
| | | fastify |
| | | .get("/api/search/user", async function (req, res) { |
| | | console.log(req.query) |
| | | const search = req.query?.search |
| | | if (!search) { |
| | |
| | | return res.send(data) |
| | | } |
| | | }) |
| | | .post("/api/search/reindex", async function (req, res) { |
| | | console.log("REINDEX ++++") |
| | | const start = Date.now() |
| | | await searchLib.doIndex().catch(console.error) |
| | | return res.send({ |
| | | status: "ok", |
| | | msg: `reindexed in ${Date.now() - start} ms`, |
| | | }) |
| | | }) |
| | | |
| | | fastify |
| | | /////// USER //////////////////////////////////////////////////////////////// |