|
8 | 8 | import * as express from 'express';
|
9 | 9 | import * as cors from 'cors';
|
10 | 10 | import * as http from 'http';
|
11 |
| -import { CompatVersions, logger } from '@orchejs/common'; |
| 11 | +import { CompatVersions, Environment, logger } from '@orchejs/common'; |
12 | 12 | import { Engine } from './';
|
13 | 13 | import {
|
14 | 14 | OrcheRestConfig,
|
@@ -43,7 +43,7 @@ export class ExpressEngine extends Engine {
|
43 | 43 | this.setupSettings();
|
44 | 44 |
|
45 | 45 | // Add Express's extensions
|
46 |
| - this.config.middlewares = this.config.middlewares || []; |
| 46 | + this.config.middlewares = this.config.middlewares; |
47 | 47 |
|
48 | 48 | // Check if CORS should be setup and add it as an extension
|
49 | 49 | if (this.config.corsConfig) {
|
@@ -98,7 +98,7 @@ export class ExpressEngine extends Engine {
|
98 | 98 | this.app.set('views', settings.views || process.cwd() + '/views');
|
99 | 99 | this.app.set('view engine', settings.viewEngine || undefined);
|
100 | 100 | this.app.set('x-powered-by', settings.xPoweredBy || false);
|
101 |
| - if (settings['env'] === 'production') { |
| 101 | + if (this.config.environment === Environment.Production) { |
102 | 102 | this.app.set('view cache', settings.viewCache || true);
|
103 | 103 | } else {
|
104 | 104 | this.app.set('view cache', settings.viewCache || undefined);
|
|
0 commit comments