Skip to content

Latest commit

 

History

History
40 lines (27 loc) · 1.2 KB

README.md

File metadata and controls

40 lines (27 loc) · 1.2 KB

Servie Mount

NPM version NPM downloads Build status Test coverage

Mount Servie middleware on a path prefix.

Installation

npm install servie-mount --save

Usage

import { mount, path, params, originalUrl } from "servie-mount";
import { compose } from "throwback";
import { Response } from "servie";

const fn = req => {
  console.log(req[path]); // Get mounted path.
  console.log(req[params]); // Get mounted params.
  console.log(req[originalUrl]); // Get original URL string.

  return new Response("hello world");
};

const app = compose([mount("/hello", fn)]);

TypeScript

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

License

Apache 2.0