EDIT: If you have the problem with nested requests or responses. Check the order of the params, or use express.router({margeParams: true}) option.
My requests are being wrapped by another object request.
I have to access 'req.body' that way -> req.req.body That is because my configuration?
I got an express server with this config:
import express from 'express';
import routes from './routes.js';
const app = express();
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use('/api', routes);
server.listen(80);
this is routes.js
import express from 'express';
import webhooksRoutes from './controllers/Webhooks/webhooksRoutes.js';
const routes = express.Router();
routes.use('/webhooks', webhooksRoutes);
this is webhooksRoutes.js
import express from 'express';
const userRoutes = express.Router();
userRoutes.post('/orders', orderWebhooks);
this is orderWebhooks.js
const wirecardOrdersWebhooks = (res, req) => {
// here the "real" request that come to the server is in res.res
const realReq = req.req
}