Initial random proxy server
This commit is contained in:
+38
@@ -0,0 +1,38 @@
|
||||
import express, { type Express } from "express";
|
||||
import cors from "cors";
|
||||
import pinoHttp from "pino-http";
|
||||
import dashboardRouter from "./routes/dashboard";
|
||||
import router from "./routes";
|
||||
import proxyRouter from "./routes/proxy";
|
||||
import { logger } from "./lib/logger";
|
||||
|
||||
const app: Express = express();
|
||||
|
||||
app.use(
|
||||
pinoHttp({
|
||||
logger,
|
||||
serializers: {
|
||||
req(req) {
|
||||
return {
|
||||
id: req.id,
|
||||
method: req.method,
|
||||
url: req.url?.split("?")[0],
|
||||
};
|
||||
},
|
||||
res(res) {
|
||||
return {
|
||||
statusCode: res.statusCode,
|
||||
};
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
app.use(cors());
|
||||
app.use(express.json({ limit: "50mb" }));
|
||||
app.use(express.urlencoded({ extended: true, limit: "50mb" }));
|
||||
|
||||
app.use(dashboardRouter);
|
||||
app.use("/api", router);
|
||||
app.use("/v1", proxyRouter);
|
||||
|
||||
export default app;
|
||||
Reference in New Issue
Block a user