diff --git a/templates/app/server/config/express.js b/templates/app/server/config/express.js index e2c0d2560..2e4b8b1cb 100644 --- a/templates/app/server/config/express.js +++ b/templates/app/server/config/express.js @@ -29,6 +29,18 @@ var Store = expressSequelizeSession(session.Store);<% } %> export default function(app) { var env = app.get('env'); + if (env === 'development' || env === 'test') { + app.use(express.static(path.join(config.root, '.tmp'))); + } + + if (env === 'production') { + app.use(favicon(path.join(config.root, 'client', 'favicon.ico'))); + } + + app.set('appPath', path.join(config.root, 'client')); + app.use(express.static(app.get('appPath'))); + app.use(morgan('dev')); + app.set('views', config.root + '/server/views');<% if (filters.html) { %> app.engine('html', require('ejs').renderFile); app.set('view engine', 'html');<% } %><% if (filters.jade) { %> @@ -73,14 +85,6 @@ export default function(app) { })); } - app.set('appPath', path.join(config.root, 'client')); - - if ('production' === env) { - app.use(favicon(path.join(config.root, 'client', 'favicon.ico'))); - app.use(express.static(app.get('appPath'))); - app.use(morgan('dev')); - } - if ('development' === env) { app.use(require('connect-livereload')({ ignore: [ @@ -92,9 +96,6 @@ export default function(app) { } if ('development' === env || 'test' === env) { - app.use(express.static(path.join(config.root, '.tmp'))); - app.use(express.static(app.get('appPath'))); - app.use(morgan('dev')); app.use(errorHandler()); // Error handler - has to be last } }