Skip to content

Commit

Permalink
feat: add body parser
Browse files Browse the repository at this point in the history
  • Loading branch information
msobiecki committed Aug 19, 2024
1 parent 13f02cf commit ad392eb
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 1 deletion.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
rateLimitMiddleware,
helmetMiddleware,
cookieMiddleware,
bodyMiddleware,
} from "@lib/middlewares";

import swaggerRouter from "@lib/swagger";
Expand All @@ -29,6 +30,7 @@ createExpress({
rateLimitMiddleware,
helmetMiddleware,
cookieMiddleware,
bodyMiddleware,
],
routers: [
["/", swaggerRouter],
Expand Down
5 changes: 5 additions & 0 deletions src/lib/middlewares/body.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { json } from "express";

const bodyMiddleware = json();

export default bodyMiddleware;
1 change: 1 addition & 0 deletions src/lib/middlewares/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as bodyMiddleware } from "./body";
export { default as cookieMiddleware } from "./cookie";
export { default as corsMiddleware } from "./cors";
export { default as helmetMiddleware } from "./helmet";
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@routes/*": ["./src/api/routes/*"],
"@validators/*": ["./src/api/validators/*"],
"@lib/*": ["./src/lib/*"],
"@database/*": ["./src/lib/database/*"],
"@database/*": ["./src/database/*"],
"@environment": ["./src/environment.ts"],
"@utils/*": ["./src/utils/*"]
},
Expand Down

0 comments on commit ad392eb

Please sign in to comment.