Skip to content

serviejs/servie-mount

Repository files navigation

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