2.0.0 • Published 5 years ago

@injectable/express-service v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

Express Service

Http server service to host resources using the express npm library under the hood.

This package works with the Inject System.

Routing

Routes get matched via the route-parser npm library

Some examples from the route-parser readme.

  • /some/(optional/):thing
  • /users/:id/comments/:comment/rating/:rating
  • /*a/foo/*b
  • /books/*section/:title
  • /books?author=:author&subject=:subject

The url params like author and subject from the last example are assigned to the params object from the request.

Usage

HttpService.setResources(this.name, [
    {
        route: "",
        method: "GET",
        onRequest: (req: Request, res: Response, next: NextFunction) => {
            //do stuff with express request ...
        }
    }
])

TBD

  • Dynamic Middleware

License

See the LICENSE file for license rights and limitations (MIT).