Open rafakwolf opened 1 year ago
Here's how I use it with Nest.
const application = await NestFactory.create(AppModule, {
bodyParser: true,
rawBody: true,
});
import { Request, Response, NextFunction } from 'express';
export function restoreBody(
req: Request & { rawBody: Uint8Array },
_res: Response,
next: NextFunction
) {
if (req.rawBody) {
req.body = req.rawBody;
}
next();
}
export default restoreBody;
const app = this.httpAdapterHost.httpAdapter.getInstance();
const sofa = useSofa({
...
});
app.use('/api', restoreBody, sofa);
Is is possible to get a full example of how you use sofa with Nestjs? @2627500295
I'm attempting to use Sofa in a Nestjs app, but the Rest endpoints are not receiving the data from post requests.
Here's an example https://github.com/rafakwolf/nestjs-sofa-poc