mirror of
https://github.com/patarapolw/cjdic2.git
synced 2026-11-09 17:39:35 +00:00
(refractor) timer and warm up query
This commit is contained in:
1 parent
1b2ee0f691
commit
d6f2b145c3
13 files changed
+294
-47
No files matched your search
@@ -11,13 +11,15 @@
|
||||
"license": "ISC",
|
||||
"packageManager": "pnpm@10.30.3",
|
||||
"dependencies": {
|
||||
"@types/adm-zip": "^0.5.7",
|
||||
"@fastify/mongodb": "^10.0.0",
|
||||
"@fastify/static": "^9.0.0",
|
||||
"adm-zip": "^0.5.16",
|
||||
"dotenv": "^17.3.1",
|
||||
"fastify": "^5.7.4",
|
||||
"mongodb": "^7.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/adm-zip": "^0.5.7",
|
||||
"@types/node": "^24.10.13",
|
||||
"tsx": "^4.21.0",
|
||||
"typescript": "~5.8.3"
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import fastify from "fastify";
|
||||
import { readdirSync } from "fs";
|
||||
import path from "path";
|
||||
|
||||
import fastifyStatic from "@fastify/static";
|
||||
|
||||
const app = fastify({
|
||||
logger: true,
|
||||
});
|
||||
|
||||
const YOMITAN_PATH = path.join(__dirname, "../src-tauri/resources/yomitan/ja");
|
||||
|
||||
app.register(fastifyStatic, {
|
||||
root: YOMITAN_PATH,
|
||||
prefix: "/api/files/yomitan/ja",
|
||||
});
|
||||
|
||||
app.get("/api/yomitan/ja/list", async () => {
|
||||
return {
|
||||
list: readdirSync(YOMITAN_PATH).filter((p) => p.endsWith(".zip")),
|
||||
};
|
||||
});
|
||||
|
||||
app.listen({ port: 3000 }).catch((e) => {
|
||||
app.log.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in new issue
Block a user