SamuelMarks / routes-merger

Generic—connect, restify, express—function to merge routes in from a Map.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

routes-merger

License NPM version npm-publish

Generic—connect, restify, express—function to merge routes from a Map.

Supported 'servers':

WiP:

Install

npm i -S @offscale/routes-merger

Usage

import { routesMerger } from '@offscale/routes-merger';

routesMerger(/*IRoutesMergerConfig*/);

Some other file:

export const getUser = (app: restify.Server, namespace: string = ''): void =>
    app.get(namespace, (req: restify.Request, res: restify.Response, next: restify.Next) => {
         req.send(200, 'I am user');
         return next();
    };

Configuration

See IRoutesMwConfig interface.

Extending

Adding a new server? - Expand the IRoutesMwConfig interface, and add a new short-function that implements it. See others for reference.

Future work

  • Finish implementing Express, Connect and generic
  • Tests

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

Generic—connect, restify, express—function to merge routes in from a Map.

License:Apache License 2.0


Languages

Language:TypeScript 100.0%