12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- 'use strict';
- const path = require('path');
- module.exports = appInfo => {
- const config = {};
- // should change to your own
- config.keys = appInfo.name + '_1503910434503_882';
- // view相关
- config.view = {
- mapping: {
- '.ejs': 'ejs',
- },
- root: [
- path.join(appInfo.baseDir, 'app/view'),
- ].join(','),
- };
- // 分页相关
- config.pageSize = 15;
- // 中间件
- config.middleware = ['urlParse'];
- // session配置
- config.session = {
- key: 'ZHC_SESS',
- maxAge: 3600 * 1000, // 1小时
- httpOnly: true,
- encrypt: true,
- };
- // session使用redis
- exports.sessionRedis = {
- name: 'session',
- };
- // 缓存时间
- config.cacheTime = 1800;
- // 安全性配置
- config.security = {
- csrf: {
- ignoreJSON: true, // 默认为 false,当设置为 true 时,将会放过所有 content-type 为 `application/json` 的请求
- },
- };
- return config;
- };
|