servie-mount

Mount Servie middleware on a prefix

Usage no npm install needed!

<script type="module">
  import servieMount from 'https://cdn.skypack.dev/servie-mount';
</script>

README

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