| | |
| | | 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") |
| | | |
| | |
| | | } |
| | | }) |
| | | |
| | | .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) { |
| | |
| | | }) |
| | | |
| | | |
| | | /////// STATIC //////////////////////////////////////////////////////////////// |
| | | /////// STATIC / SPA //////////////////////////////////////////////////////////////// |
| | | |
| | | |
| | | fastify.register(require('@fastify/static'), { |
| | |
| | | |
| | | // 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) { |