/servie-route

Simple route middleware for Servie

Primary LanguageTypeScriptOtherNOASSERTION

Servie Route

NPM version NPM downloads Build status Test coverage

Simple route middleware for Servie.

Installation

npm install servie-route --save

Usage

import { get, post } from 'servie-route'
import { compose } from 'throwback'

const animals = [
  'rabbit',
  'dog',
  'cat'
]

const app = compose([
  get('/pets', function () {
    return new Response({ body: animals })
  }),
  get('/pets/:id', function (req) {
    return new Response({ body: animals[Number(req.params[0])] })
  })
])

TypeScript

This project is written using TypeScript and publishes the definitions directly to NPM.

License

Apache 2.0