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

routexjs/routex-hooks

Repository files navigation

Routex Hooks npm Travis CI Codecov

Hooks for Routex.

Documentation - GitHub

Example

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}`));

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.