feat(web): checkpoint web app init
- frontend (Vite/React) + server (Hono/Drizzle) scaffold under web/ - eeschema WASM embind kicadOpenFile hook + programmatic open-flow - skip KiCad first-run setup wizard by seeding default config in preRun - dev: auto-sync output/ WASM artifacts into tests/apps/kicad via link-wasm Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e28f473040
commit
735e5aa8e9
70 changed files with 7775 additions and 13 deletions
32
web/apps/server/src/app.ts
Normal file
32
web/apps/server/src/app.ts
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import cors from "@fastify/cors";
|
||||
import multipart from "@fastify/multipart";
|
||||
import Fastify, { type FastifyInstance } from "fastify";
|
||||
import { env } from "./env.js";
|
||||
import { apiPlugin } from "./routes/api.js";
|
||||
import { fileRoutes } from "./routes/files.js";
|
||||
|
||||
export async function buildApp(): Promise<FastifyInstance> {
|
||||
const app = Fastify({
|
||||
logger: true,
|
||||
// Project files (whole KiCad trees) and zips can be large.
|
||||
bodyLimit: 1024 * 1024 * 1024,
|
||||
});
|
||||
|
||||
await app.register(cors, {
|
||||
origin: env.CORS_ORIGIN === "*" ? true : env.CORS_ORIGIN.split(","),
|
||||
});
|
||||
|
||||
await app.register(multipart, {
|
||||
limits: {
|
||||
fileSize: 1024 * 1024 * 1024, // 1 GiB per file
|
||||
files: 5000, // a KiCad project can have many lib files
|
||||
},
|
||||
});
|
||||
|
||||
app.get("/health", async () => ({ ok: true }));
|
||||
|
||||
await app.register(apiPlugin);
|
||||
await app.register(fileRoutes);
|
||||
|
||||
return app;
|
||||
}
|
||||
Loading…
Reference in a new issue