docs: function initApp(options,app) {    
      app.set('trust proxy', 1);
  
      //在中间件之前使用中间件
      if(options.beforeMid) {
          options.beforeMid(app,middlewares);
      }
  
      //session中间件
      app.use(session(options.session));
      //cookies解析中间件
      app.use(cookieParser());
      //日志中间件
      app.use(morgan('combined'));
      //faviocn中间件
      app.use(favicon(options.public +path.sep+'favicon.ico'));
      //spm调试中间件
      if (env === 'development') {
          app.use(serveSPM(options.client, {
              log: console.log
          }));
          app.use(express.static(options.public));
      } else if (env === 'test') {
          //静态目录
          app.use(express.static(options.public));
      }
  
      //声明小部件目录
      hbs.registerPartials(options.partials);
  
      //设置handlebars视图引擎
      app.set('view engine', options.tempExt);
      app.engine(options.tempExt, hbs.__express);
      app.set('views', options.views);
  
      //body 序列化
      app.use(bodyParser.json());
      app.use(bodyParser.urlencoded({
          extended: false,
          limit:options.bodyLimit||'1000kb'
      }));
  
      return app;
  }