REST Service for POPCORN - ILIAS
alex
2025-06-15 e11dc9345a753d43e8ab92638fad392ec546b8bb
app.js
@@ -6,6 +6,7 @@
const fs = require("node:fs")
const db = require("./lib/db")
const libIlias = require("lib/libIlias")
const settings = require("./settings")
const search = require("./lib/search.js")
@@ -98,6 +99,19 @@
      }
   })
   .delete("/api/user/:usr_id", function (req, res) {
      const {usr_id} = req.params
      if (!usr_id || isNaN(Number(usr_id))) {
         return res.code(500).send({status: "error", msg: "userId error"})
      }
      else {
         const res2 = libIlias.deleteUser(usr_id)
         console.log(res2)
         return res.send(res2)
      }
   })
   /////// ref_id / obj_id  ////////////////////////////////////////////////////////////////
   .get("/api/ref_id/:ref_id", async function (req, res) {
@@ -174,7 +188,7 @@
   })
/////// STATIC ////////////////////////////////////////////////////////////////
/////// STATIC / SPA ////////////////////////////////////////////////////////////////
fastify.register(require('@fastify/static'), {
@@ -183,19 +197,6 @@
   // constraints: { host: 'example.com' } // optional: default {}
})
// fastify.get('*', function (req, reply) {
//    console.log("!!!!!!!!! send index")
//    // index.html should never be cached
//    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) {