Mount Servie middleware on a path prefix.
npm install servie-mount --save
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)]);
This project is written using TypeScript and publishes the definitions directly to NPM.
Apache 2.0