|
|
@@ -173,12 +173,6 @@ expressLocals(webRouter, privateApiRouter, publicApiRouter)
|
|
|
|
|
|
webRouter.use(SessionAutostartMiddleware.invokeCallbackMiddleware)
|
|
|
|
|
|
-if (app.get('env') === 'production') {
|
|
|
- logger.info('Production Enviroment')
|
|
|
- app.enable('view cache')
|
|
|
- Views.precompileViews(app)
|
|
|
-}
|
|
|
-
|
|
|
webRouter.use(function(req, res, next) {
|
|
|
if (Settings.siteIsOpen) {
|
|
|
next()
|
|
|
@@ -240,6 +234,11 @@ const enableWebRouter =
|
|
|
if (enableWebRouter || notDefined(enableWebRouter)) {
|
|
|
logger.info('providing web router')
|
|
|
|
|
|
+ if (app.get('env') === 'production') {
|
|
|
+ logger.info('precompiling views for web in production environment')
|
|
|
+ Views.precompileViews(app)
|
|
|
+ }
|
|
|
+
|
|
|
app.use(publicApiRouter) // public API goes with web router for public access
|
|
|
app.use(Validation.errorMiddleware)
|
|
|
app.use(HttpErrorController.handleError)
|