Skip to content

Commit 05dea56

Browse files
author
IG\tvalcke
committed
fix(tserver): remove duplicate applications declaration and remove/add some express config
1 parent cf29128 commit 05dea56

File tree

1 file changed

+17
-32
lines changed

1 file changed

+17
-32
lines changed

sources/TServer.js

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -67,43 +67,28 @@ class TServer {
6767

6868
_initApplications ( config ) {
6969

70-
this.applications = express()
70+
if ( config.case_sensitive_routing ) { this.applications.set( 'case sensitive routing', config.case_sensitive_routing ) }
71+
if ( config.env ) { this.applications.set( 'env', config.env ) }
72+
if ( config.etag ) { this.applications.set( 'etag', config.etag ) }
73+
if ( config.jsonp_callback_name ) { this.applications.set( 'jsonp callback name', config.jsonp_callback_name ) }
74+
if ( config.jsonp_escape ) { this.applications.set( 'json escape', config.jsonp_escape ) }
75+
if ( config.jsonp_replacer ) { this.applications.set( 'json replacer', config.jsonp_replacer ) }
76+
if ( config.jsonp_spaces ) { this.applications.set( 'json spaces', config.jsonp_spaces ) }
77+
if ( config.query_parser ) { this.applications.set( 'query parser', config.query_parser ) }
78+
if ( config.strict_routing ) { this.applications.set( 'strict routing', config.strict_routing ) }
79+
if ( config.subdomain_offset ) { this.applications.set( 'subdomain offset', config.subdomain_offset ) }
80+
if ( config.trust_proxy ) { this.applications.set( 'trust proxy', config.trust_proxy ) }
81+
if ( config.views ) { this.applications.set( 'views', config.views ) }
82+
if ( config.view_cache ) { this.applications.set( 'view cache', config.view_cache ) }
83+
if ( config.view_engine ) { this.applications.set( 'view engine', config.view_engine ) }
84+
if ( config.x_powered_by ) { this.applications.set( 'x-powered-by', config.x_powered_by ) }
7185

72-
this.applications.set( 'env', config.env )
73-
this.applications.set( 'hostName', config.hostname )
74-
this.applications.set( 'port', config.port )
75-
this.applications.set( 'db uri', config.db_uri )
76-
this.applications.set( 'views', config.views )
77-
this.applications.set( 'view engine', config.view_engine )
78-
this.applications.set( 'jsonp callback name', config.jsonp_callback_name )
79-
this.applications.set( 'json replacer', config.jsonp_replacer )
80-
this.applications.set( 'json spaces', config.jsonp_spaces )
81-
82-
if ( config.trust_proxy ) {
83-
this.applications.enable( 'trust proxy' )
84-
} else {
85-
this.applications.disabled( 'trust proxy' )
86-
}
86+
this._initMiddlewares( config.middlewares )
8787

88-
if ( config.case_sensitive_routing ) {
89-
this.applications.enable( 'case sensitive routing' )
90-
} else {
91-
this.applications.disabled( 'case sensitive routing' )
92-
}
88+
}
9389

94-
if ( config.strict_routing ) {
95-
this.applications.enable( 'strict routing' )
96-
} else {
97-
this.applications.disabled( 'strict routing' )
98-
}
9990

100-
if ( config.view_cache ) {
101-
this.applications.enable( 'view cache' )
102-
} else {
103-
this.applications.disabled( 'view cache' )
104-
}
10591

106-
this._initMiddlewares( config.middlewares )
10792

10893
}
10994

0 commit comments

Comments
 (0)