mirror of
https://github.com/patarapolw/cjdic2.git
synced 2026-11-08 17:35:18 +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
@@ -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