Restructure backend into modular API layers with admin/organizador/invitados routes, add role-based middleware, flatten module models, and update build scripts
This commit is contained in:
23
packages/server/src/app.ts
Normal file
23
packages/server/src/app.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import express from "express";
|
||||
import { json } from "body-parser";
|
||||
import path from "path";
|
||||
import { registerApiRoutes } from "./api";
|
||||
|
||||
export async function createApp() {
|
||||
const app = express();
|
||||
|
||||
app.use(json());
|
||||
|
||||
registerApiRoutes(app);
|
||||
|
||||
// In production, serve the built admin UI
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
const adminDist = path.join(__dirname, "../../admin/dist");
|
||||
app.use(express.static(adminDist));
|
||||
app.get("/*", (_req, res) => {
|
||||
res.sendFile(path.join(adminDist, "index.html"));
|
||||
});
|
||||
}
|
||||
|
||||
return app;
|
||||
}
|
||||
Reference in New Issue
Block a user