From 0c2d8b058b4edd21922b5b4eca6c149046aee090 Mon Sep 17 00:00:00 2001
From: alex <alex@alexloehr.net>
Date: Tue, 10 Jun 2025 08:19:29 +0000
Subject: [PATCH] adding favicon

---
 app.js |   43 +++++++++++++++++++++++++------------------
 1 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/app.js b/app.js
index 7b99446..76d02e4 100644
--- a/app.js
+++ b/app.js
@@ -32,11 +32,28 @@
    }
 })
 
+/////// SEARCH ////////////////////////////////////////////////////////////////
+
+const searchLib = require("./lib/search")
+searchLib.doIndex().catch(console.error)
+fastify.get("/api/search/user", async function (req, res) {
+   console.log(req.query)
+   const search = req.query?.search
+   if (!search) {
+      return res.code(422).send({status: "error", msg: "no search"})
+   }
+   else {
+      console.log(search)
+      const data = await searchLib.search(search)
+      return res.send(data)
+   }
+})
+
 fastify
    /////// USER ////////////////////////////////////////////////////////////////
    .get('/api/users', async function (req, res) {
-      const {offset, limit} = req.query
-      const users = await db.getUsers(offset, limit)
+      const {offset, limit, search} = req.query
+      const users = await db.getUsers(offset, limit, search)
       return res.send(users)
    })
    .get("/api/users/count", async function (req, res) {
@@ -156,22 +173,6 @@
       }
    })
 
-/////// SEARCH ////////////////////////////////////////////////////////////////
-
-const searchLib = require("./lib/search")
-searchLib.doIndex().catch(console.error)
-fastify.get("/api/search/user", async function (req, res) {
-   console.log(req.query)
-   const search = req.query?.search
-   if (!search) {
-      return res.code(422).send({status: "error", msg: "no search"})
-   }
-   else {
-      console.log(search)
-      const data = await searchLib.search(search)
-      return res.send(data)
-   }
-})
 
 /////// STATIC ////////////////////////////////////////////////////////////////
 
@@ -190,6 +191,12 @@
 //    reply.sendFile('dist/index.html', {maxAge: 0, immutable: false})
 // })
 
+// const favicon = fs.readFileSync("./favicon-32x32.webp")
+// fastify.get("/ui/favicon.webp", async function (req, res) {
+//    console.log("<<<<<<<<<<<<<<<<<<<<< favicon", favicon.length)
+//    res.type("image/webp").send(favicon)
+// })
+
 const indexFile = fs.readFileSync(path.join(__dirname, "vue/dist", 'index.html'), 'utf8')
 fastify.setNotFoundHandler(function (req, res) {
    console.log("!!!")

--
Gitblit v1.8.0