Hooks for Routex.
Install:
yarn add @routex/hooks
# or
npm add @routex/hooks
Setup your app:
const { Routex, TextBody } = require("routex");
const { hooksHandler, useGetParam, useSetBody } = require("@routex/hooks");
const port = process.env.PORT || 3000;
const app = new Routex();
app.get(
"/:name",
hooksHandler(() => {
const name = useGetParam("name");
useSetBody(new TextBody(name));
})
);
app.listen(port).then(() => console.log(`Listening on ${port}`));
We support all currently active and maintained Node LTS versions, include current Node versions.
Please file feature requests and bugs at the issue tracker.