@@ -88,7 +88,6 @@ You can use routing-controllers with [express.js][1] or [koa.js][2].
8888 and make sure to import it before you use routing-controllers:
8989
9090 ``` typescript
91-
9291 ```
9392
94933 . Install framework:
@@ -165,7 +164,7 @@ In prior versions, these were direct dependencies, but now they are peer depende
1651642 . Create a file ` app.ts `
166165
167166 ``` typescript
168- // this shim is required
167+ // this shim is required
169168 import { createExpressServer } from ' routing-controllers' ;
170169 import { UserController } from ' ./UserController' ;
171170
@@ -301,7 +300,6 @@ If you have, or if you want to create and configure express app separately,
301300you can use ` useExpressServer ` instead of ` createExpressServer ` function:
302301
303302``` typescript
304-
305303import { useExpressServer } from ' routing-controllers' ;
306304
307305let express = require (' express' ); // or you can import it if you have installed typings
@@ -322,7 +320,6 @@ You can load all controllers from directories, by specifying array of directorie
322320` createExpressServer ` or ` useExpressServer ` :
323321
324322``` typescript
325-
326323import { createExpressServer } from ' routing-controllers' ;
327324
328325createExpressServer ({
@@ -337,7 +334,6 @@ createExpressServer({
337334If you want to prefix all your routes, e.g. ` /api ` you can use ` routePrefix ` option:
338335
339336``` typescript
340-
341337import { createExpressServer } from ' routing-controllers' ;
342338import { UserController } from ' ./controller/UserController' ;
343339
@@ -774,7 +770,6 @@ Since CORS is a feature that is used almost in any web-api application,
774770you can enable it in routing-controllers options.
775771
776772``` typescript
777-
778773import { createExpressServer } from ' routing-controllers' ;
779774import { UserController } from ' ./UserController' ;
780775
@@ -791,7 +786,6 @@ For express its `npm i cors`, for koa its `npm i kcors`.
791786You can pass cors options as well:
792787
793788``` typescript
794-
795789import { createExpressServer } from ' routing-controllers' ;
796790import { UserController } from ' ./UserController' ;
797791
@@ -810,7 +804,6 @@ app.listen(3000);
810804You can override default status code in routing-controllers options.
811805
812806``` typescript
813-
814807import { createExpressServer } from ' routing-controllers' ;
815808import { UserController } from ' ./UserController' ;
816809
@@ -894,7 +887,6 @@ For example, lets try to use [compression](https://github.com/expressjs/compress
8948874 . If you want to use compression module globally for all controllers you can simply register it during bootstrap:
895888
896889 ``` typescript
897-
898890 import { createExpressServer } from ' routing-controllers' ;
899891 import { UserController } from ' ./UserController' ; // we need to "load" our controller before call createExpressServer. this is required
900892 let compression = require (' compression' );
@@ -1053,7 +1045,6 @@ export class LoggingMiddleware implements ExpressMiddlewareInterface {
10531045To enable this middleware, specify it during routing-controllers initialization:
10541046
10551047``` typescript
1056-
10571048import { createExpressServer } from ' routing-controllers' ;
10581049import { UserController } from ' ./UserController' ;
10591050import { LoggingMiddleware } from ' ./LoggingMiddleware' ;
@@ -1097,7 +1088,6 @@ createExpressServer({
10971088Also you can load middlewares from directories. Also you can use glob patterns:
10981089
10991090``` typescript
1100-
11011091import { createExpressServer } from ' routing-controllers' ;
11021092createExpressServer ({
11031093 controllers: [__dirname + ' /controllers/**/*.js' ],
@@ -1187,7 +1177,6 @@ You have ability to do this using [class-transformer][4].
11871177To use it simply specify a ` classTransformer: true ` option on application bootstrap:
11881178
11891179``` typescript
1190-
11911180import { createExpressServer } from ' routing-controllers' ;
11921181
11931182createExpressServer ({
@@ -1259,7 +1248,6 @@ E.g. `class-transformer` doesn't check whether the property's types are correct,
12591248It can be done easily thanks to integration with [ class-validator] [ 9 ] . This behaviour is ** enabled** by default. If you want to disable it, you need to do it explicitly e.g. by passing ` validation: false ` option on application bootstrap:
12601249
12611250``` typescript
1262-
12631251import { createExpressServer } from ' routing-controllers' ;
12641252
12651253createExpressServer ({
@@ -1318,7 +1306,6 @@ Routing-controllers comes with two decorators helping you to organize authorizat
13181306To make ` @Authorized ` decorator to work you need to setup special routing-controllers options:
13191307
13201308``` typescript
1321-
13221309import { createExpressServer , Action } from ' routing-controllers' ;
13231310
13241311createExpressServer ({
@@ -1360,7 +1347,6 @@ export class SomeController {
13601347To make ` @CurrentUser ` decorator to work you need to setup special routing-controllers options:
13611348
13621349``` typescript
1363-
13641350import { createExpressServer , Action } from ' routing-controllers' ;
13651351
13661352createExpressServer ({
@@ -1397,7 +1383,6 @@ middlewares and error handlers. Container must be setup during application boots
13971383Here is example how to integrate routing-controllers with [ typedi] ( https://github.com/typestack/typedi ) :
13981384
13991385``` typescript
1400-
14011386import { createExpressServer , useContainer } from ' routing-controllers' ;
14021387import { Container } from ' typedi' ;
14031388
0 commit comments