feat: use middleware
This commit is contained in:
parent
9c176b9878
commit
d01d4ef40a
1 changed files with 4 additions and 0 deletions
|
|
@ -5,6 +5,7 @@ import swaggerUi from "swagger-ui-express";
|
||||||
import swaggerDocument from "./swagger.json";
|
import swaggerDocument from "./swagger.json";
|
||||||
import error from "./middlewares/error";
|
import error from "./middlewares/error";
|
||||||
import { RegisterRoutes } from "./routes";
|
import { RegisterRoutes } from "./routes";
|
||||||
|
import logMiddleware from "./middlewares/log";
|
||||||
|
|
||||||
const APP_HOST = process.env.APP_HOST || "0.0.0.0";
|
const APP_HOST = process.env.APP_HOST || "0.0.0.0";
|
||||||
const APP_PORT = +(process.env.APP_PORT || 3000);
|
const APP_PORT = +(process.env.APP_PORT || 3000);
|
||||||
|
|
@ -15,6 +16,9 @@ const APP_PORT = +(process.env.APP_PORT || 3000);
|
||||||
app.use(cors());
|
app.use(cors());
|
||||||
app.use(json());
|
app.use(json());
|
||||||
app.use(urlencoded({ extended: true }));
|
app.use(urlencoded({ extended: true }));
|
||||||
|
|
||||||
|
app.use(logMiddleware);
|
||||||
|
|
||||||
app.use("/", express.static("static"));
|
app.use("/", express.static("static"));
|
||||||
app.use("/api-docs", swaggerUi.serve, swaggerUi.setup(swaggerDocument));
|
app.use("/api-docs", swaggerUi.serve, swaggerUi.setup(swaggerDocument));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue