Вот мой следующий код моего express приложения с машинописным текстом 3.7.4:
import bodyParser from "body-parser";
import config from "config";
import cookieParser from "cookie-parser";
import express from "express";
import mongoose from "mongoose";
import path from "path";
export default class App {
public app: express.Application;
constructor() {
this.app = express();
this.initializeMiddlewares();
}
public listen(port: any) {
this.app.listen(port, () => {
console.log(`App listening on the port ${port}`);
});
}
public initializeControllers(controllers: any) {
controllers.forEach((controller: any) => {
this.app
.use(bodyParser.json())
.use(bodyParser.urlencoded())
.use("/", controller.router);
});
}
}`
Пожалуйста, помогите мне с этой частью кода. Я не понимаю, почему я получаю undefined в request.body, когда я отправляю почтовый запрос.