File tree Expand file tree Collapse file tree 4 files changed +21
-4
lines changed
Expand file tree Collapse file tree 4 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 44 "description" : " A delightful way to building a RESTful API with NodeJs & TypeScript" ,
55 "main" : " src/app.ts" ,
66 "engines" : {
7- "node" : " 7.7.3 "
7+ "node" : " 8.2.1 "
88 },
99 "scripts" : {
1010 "start" : " node dist/app.js" ,
6363 "@types/request" : " ^2.0.7" ,
6464 "@types/request-promise" : " ^4.1.39" ,
6565 "@types/serve-favicon" : " ^2.2.29" ,
66+ "@types/uuid" : " ^3.4.3" ,
6667 "@types/winston" : " ^2.3.7" ,
6768 "body-parser" : " ^1.18.2" ,
6869 "bookshelf" : " ^0.10.4" ,
103104 "ts-node" : " ^3.3.0" ,
104105 "tslint" : " ^5.8.0" ,
105106 "typescript" : " ^2.6.1" ,
107+ "uuid" : " ^3.1.0" ,
106108 "wait-on" : " ^2.0.2" ,
107109 "winston" : " ^2.4.0"
108110 },
Original file line number Diff line number Diff line change 55 * Define all log adapters for this application and chose one.
66 */
77
8+ import * as express from 'express' ;
9+ import * as uuid from 'uuid' ;
10+
811import { Logger } from '../core/Logger' ;
912import { App , Configurable } from '../core/App' ;
13+ import { Environment } from '../core/helpers/Environment' ;
1014
1115
1216export class CustomConfig implements Configurable {
@@ -15,6 +19,13 @@ export class CustomConfig implements Configurable {
1519
1620 public configure ( app : App ) : void {
1721 this . log . debug ( 'configuring' , app . Express . get ( 'port' ) ) ;
22+
23+ app . Express . use ( ( req : express . Request , res : express . Response , next : express . NextFunction ) => {
24+ res . setHeader ( 'X-API-VERSION' , Environment . getPkg ( ) . version ) ;
25+ res . setHeader ( 'X-Request-Id' , uuid . v4 ( ) ) ;
26+ next ( ) ;
27+ } ) ;
28+
1829 }
1930}
2031
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import * as express from 'express';
22import { Environment } from './helpers/Environment' ;
33import { SwaggerUI } from './SwaggerUI' ;
44import { ApiMonitor } from './ApiMonitor' ;
5- import { BasicAuthenticate } from './BasicAuthenticate' ;
5+ // import { BasicAuthenticate } from './BasicAuthenticate';
66
77
88export class ApiInfo {
@@ -16,8 +16,6 @@ export class ApiInfo {
1616 application . get (
1717 ApiInfo . getRoute ( ) ,
1818 // @ts -ignore: False type definitions from express
19- BasicAuthenticate ( ) ,
20- // @ts -ignore: False type definitions from express
2119 ( req : myExpress . Request , res : myExpress . Response ) => {
2220 const pkg = Environment . getPkg ( ) ;
2321 const links = {
Original file line number Diff line number Diff line change 270270 dependencies :
271271 " @types/node" " *"
272272
273+ " @types/uuid@^3.4.3 " :
274+ version "3.4.3"
275+ resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-3.4.3.tgz#121ace265f5569ce40f4f6d0ff78a338c732a754"
276+ dependencies :
277+ " @types/node" " *"
278+
273279" @types/winston@^2.3.7 " :
274280 version "2.3.7"
275281 resolved "https://registry.yarnpkg.com/@types/winston/-/winston-2.3.7.tgz#2ea18b2dc772d459b6af0f587447704df31afec2"
You can’t perform that action at this time.
0 commit comments