Open ChelesteWang opened 3 years ago
$ npm install dotenv --save-dev
使用 config
const envConfig = dotenv.config({
path: path.resolve(__dirname, '../.env'), // 配置文件路径
encoding: 'utf8', // 编码方式,默认utf8
debug: false, // 是否开启debug,默认false
}).parsed;
if (!envConfig) {
console.log('配置文件不存在');
// 退出程序
process.exit(1);
}
不应在 Application 中开启 gzip
在大业务量的生产环境网站中,强烈推荐将压缩功能从应用服务器中卸载——典型做法是使用反向代理(例如 Nginx)。在这种情况下,你不应该使用压缩中间件。
建议使用 nginx 进行部署