feat: both nest and next backends

This commit is contained in:
2024-12-28 20:37:20 +01:00
parent ed3e59e079
commit dfa3d1c40a
68 changed files with 10699 additions and 1 deletions

33
back-express/src/app.ts Normal file
View File

@@ -0,0 +1,33 @@
import express from "express";
import config from "./config";
import cors from "cors";
import { routes } from "./modules";
import { authorizationMiddleware } from "./modules/auth/auth.middleware";
const app = express();
const port = config.port;
if (config.enableCors) {
app.use(cors());
}
app.use(express.json());
// Global middleware
app.use(authorizationMiddleware as any); // TODO: move out of here
app.use((req, _res, next) => {
console.log(`LOG: new ${req.method} request for ${req.url}`);
next();
});
// Route specific middleware
app.use("/example", (req, _res, next) => {
console.log(`LOG: new ${req.method} example request for ${req.url}`);
next();
});
app.use(config.baseRoute, routes); // / serves as the base for the imported routes
app.listen(port, () => {
console.log(`Server running at http://localhost:${port}`);
});