New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@koax/route

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@koax/route

Simple route middlekoax for koax.

latest
Source
npmnpm
Version
0.3.0
Version published
Maintainers
1
Created
Source

route

Build status Git tag NPM version Code style

Simple route middlekoax for koax.

Installation

$ npm install @koax/route

Usage

import koax from 'koax'
import {route, request} from '@koax/route'

let router = koax()

router.use(route('/dep', () => 'norf'))
router.use(route('/foo', function * () {
  let res = yield request('/dep')
  return 'bar ' + res
}))

router(request('/foo')).then((res) => res) // => 'bar norf'

API

route(path, handler)

Route middleware.

  • path - path
  • handler - function to execute on matched path. handler has signature handler(params).

Returns: koax middleware

request(path, params)

Request action creator.

  • path - path to request
  • params - params to path to handler

Returns: action object

mount(path, middleware)

Mount middleware.

  • path - path to mount middleware at
  • middleware - middleware to mount

Returns: koax middleware

License

MIT

FAQs

Package last updated on 04 Feb 2016

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