From c610ba77e8975258528e2f81149998c400a96ecc Mon Sep 17 00:00:00 2001 From: "Remo H. Jansen" Date: Thu, 7 Dec 2017 00:49:11 +0000 Subject: [PATCH] improved docs (#89) --- README.md | 10 ++++++---- package.json | 2 +- src/debug.ts | 4 ++-- test/debug.test.ts | 4 ++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 33977b55..c4df56c2 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,8 @@ Some utilities for the development of express applications with Inversify. You can install `inversify-express-utils` using npm: -``` -$ npm install inversify inversify-express-utils reflect-metadata --save +```sh +npm install inversify inversify-express-utils reflect-metadata --save ``` The `inversify-express-utils` type definitions are included in the npm module and require TypeScript 2.0. @@ -524,12 +524,14 @@ console.log(prettyjson.render({ routes: routeInfo })); // ... ``` +> :warning: Please ensure that you invoke `getRouteInfo` after invoking `server.build()`! + The output formatter by `prettyjson` looks as follows: ```txt routes: - - controller: Symbol(OrderController) + controller: OrderController endpoints: - route: GET /api/order/ @@ -540,7 +542,7 @@ routes: route: - @requestParam id - - controller: Symbol(UserController) + controller: UserController endpoints: - route: GET /api/user/ diff --git a/package.json b/package.json index 36025cbe..babd96a5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "inversify-express-utils", - "version": "5.1.0", + "version": "5.1.1", "description": "Some utilities for the development of express applications with Inversify", "main": "lib/index.js", "jsnext:main": "es/index.js", diff --git a/src/debug.ts b/src/debug.ts index 3b812425..aa5dbfc7 100644 --- a/src/debug.ts +++ b/src/debug.ts @@ -1,7 +1,7 @@ import { interfaces as inversifyInterfaces } from "inversify"; import { BaseHttpController } from "./base_http_controller"; import { interfaces } from "./interfaces"; -import { PARAMETER_TYPE } from "./constants"; +import { PARAMETER_TYPE, TYPE } from "./constants"; import { getControllersFromContainer, getControllerMetadata, @@ -15,7 +15,7 @@ export function getRouteInfo(container: inversifyInterfaces.Container) { const info = raw.map(r => { - const controllerId = Symbol.for(r.controllerMetadata.target.name).toString(); + const controllerId = r.controllerMetadata.target.name; const endpoints = r.methodMetadata.map(m => { diff --git a/test/debug.test.ts b/test/debug.test.ts index 52511cb9..5b9663b0 100644 --- a/test/debug.test.ts +++ b/test/debug.test.ts @@ -64,8 +64,8 @@ describe("Debug utils", () => { } const TYPES = { - OrderController: Symbol.for(OrderController.name).toString(), - UserController: Symbol.for(UserController.name).toString() + OrderController: OrderController.name, + UserController: UserController.name }; let server = new InversifyExpressServer(container);