Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/serviejs/servie-mount
Mount Servie middleware on a prefix
https://github.com/serviejs/servie-mount
application middleware mount servie typescript
Last synced: 8 days ago
JSON representation
Mount Servie middleware on a prefix
- Host: GitHub
- URL: https://github.com/serviejs/servie-mount
- Owner: serviejs
- License: other
- Created: 2017-01-27T21:17:17.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-12-12T07:31:36.000Z (about 1 year ago)
- Last Synced: 2024-12-08T06:34:53.916Z (28 days ago)
- Topics: application, middleware, mount, servie, typescript
- Language: TypeScript
- Size: 699 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Servie Mount
[![NPM version](https://img.shields.io/npm/v/servie-mount.svg?style=flat)](https://npmjs.org/package/servie-mount)
[![NPM downloads](https://img.shields.io/npm/dm/servie-mount.svg?style=flat)](https://npmjs.org/package/servie-mount)
[![Build status](https://img.shields.io/travis/serviejs/servie-mount.svg?style=flat)](https://travis-ci.org/serviejs/servie-mount)
[![Test coverage](https://img.shields.io/coveralls/serviejs/servie-mount.svg?style=flat)](https://coveralls.io/r/serviejs/servie-mount?branch=master)> Mount Servie middleware on a path prefix.
## Installation
```
npm install servie-mount --save
```## Usage
```ts
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](https://github.com/Microsoft/TypeScript) and publishes the definitions directly to NPM.
## License
Apache 2.0