Body parsing for Routex.
Install:
yarn add @routex/body-parser
# or
npm add @routex/body-parser
Setup your app:
const { Routex, JsonBody } = require("routex");
const bodyParser = require("@routex/body-parser");
const port = process.env.PORT || 3000;
const app = new Routex();
app.use(bodyParser.json());
app.get("/", (ctx) => {
ctx.body = new JsonBody(ctx.req.body);
});
app.listen(port).then(() => console.log(`Listening on ${port}`));
The parsed body is available under ctx.req.body
.
We support all currently active and maintained Node LTS versions, include current Node versions.
Please file feature requests and bugs at the issue tracker.