Authored by weiqingting

腾讯云 preview

@@ -14,6 +14,8 @@ var config = require('./config/common'); @@ -14,6 +14,8 @@ var config = require('./config/common');
14 var util = require('./util/common'); 14 var util = require('./util/common');
15 var multipart = require('connect-multiparty'); 15 var multipart = require('connect-multiparty');
16 16
  17 +var env = process.env.NODE_ENV || 'development';
  18 +
17 19
18 var options = { 20 var options = {
19 //初始化yo的app 21 //初始化yo的app
@@ -34,6 +36,10 @@ var options = { @@ -34,6 +36,10 @@ var options = {
34 beforeMid:function(app,mids) {//使用handlebars-layouts 36 beforeMid:function(app,mids) {//使用handlebars-layouts
35 require('handlebars-layouts').register(mids.hbs.handlebars); 37 require('handlebars-layouts').register(mids.hbs.handlebars);
36 app.use(multipart()); 38 app.use(multipart());
  39 + if (env === 'preview') {
  40 + //静态目录
  41 + app.use(express.static(options.envStatic.preview));
  42 + }
37 }, 43 },
38 beforeCustMid: function (app, routers) { 44 beforeCustMid: function (app, routers) {
39 app.use(auth);//权限验证 45 app.use(auth);//权限验证