@routex/hooks
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

Routex Hooks npm Travis CI Codecov Greenkeeper badge

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.

Readme

Keywords

Package Sidebar

Install

npm i @routex/hooks

Weekly Downloads

0

Version

0.0.2

License

MIT

Unpacked Size

11.8 kB

Total Files

17

Last publish

Collaborators

  • cretezy