Exciting release!Introducing "safe npm". Learn more
Socket
Log inDemoInstall

koa-fp-ts-router

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Issues
File Explorer

Advanced tools

koa-fp-ts-router

A Koa router middleware built on the top of fp-ts-routing

    0.2.1latest
    GitHub

Version published
Maintainers
1
Weekly downloads
469
decreased by-15.65%

Weekly downloads

Readme

Source

koa-fp-ts-router

npm

A Koa router middleware built on the top of fp-ts-routing.

Installation

Note that these packages are peer dependencies of this library, which need to be installed separately.

Using npm

$ npm install koa-fp-ts-router

Using yarn

$ yarn add koa-fp-ts-router

Usage

import { end, lit, str } from 'fp-ts-routing'; import Koa from 'koa'; import { Router } from 'koa-fp-ts-router'; const app = new Koa(); // matches const root = end; // `/` const user = lit('users').then(str('id')).then(end); // `/users/:id` // routes const router = new Router(); router.get(root, function (ctx) { ctx.body = 'Hello, world!'; }); router.get(user, function (ctx) { ctx.body = `Hello, ${ctx.params.id}!`; }); // Use the router middleware app.use(router.routes()); app.listen(3000);

Keywords

FAQs

Last updated on 24 Aug 2022

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc