Installation

Install is simple and easy:

yarn add routex
# or
npm install routex

Hello World

Create an index.js and setup your first Routex server:

const { Routex, TextBody, JsonBody } = require("routex");
const port = process.env.PORT || 3000;
const app = new Routex();
app.get("/", () => {
return new TextBody("Hello world!");
});
app.get("/:name", (ctx) => {
return new JsonBody({ hello: ctx.params.name });
});
app.listen(port).then(() => console.log(`Listening on ${port}`));