Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

koa-router-rx

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-router-rx

Reactive router middleware for koa

  • 0.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

koa-router-rx   npm version Build Status Coverage Status

Router middleware for koa 2.x based on koa-router and rxjs.

Introduction

koa-router-rx is an extension of koa-router that supports functions of RxJS Observables instead of regular middleware. Those functions are called "Epics", a concept directly inspired by redux-observable.

An Epic is a function that takes an Observable argument and returns an Observable:

(observable: Observable<A>) => Observable<B>

Usage

koa-router-rx works just like koa-router, except that it expects an Epic instead of a koa-style middleware:

import Koa from 'koa'
import RxRouter from '../lib'

const router = new RxRouter()

router.get('/hello', observable => observable.mapTo('Hello!'))

app.use(router.routes())
app.listen(3333)

See the example for more details.

Caveats

Keywords

FAQs

Package last updated on 02 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc