Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

routexjs/routex-body-parser

Repository files navigation

Routex Body Parser npm Travis CI Codecov

Body parsing for Routex.

Documentation - GitHub

Example

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.

Support

We support all currently active and maintained Node LTS versions, include current Node versions.

Please file feature requests and bugs at the issue tracker.