你好,
你能帮我在运行服务器时覆盖默认端口和主机吗
环境变量(process.env.PORT)以及我想在哪里进行更改。
谢谢,
古瑟姆KD
https://github.com/jaredpalmer/razzle#environment -variables
如下所述,将PORT=1313
等添加到您的.env
文件中
在下次提问之前,您可以尝试查看自述文件吗?
下次可能会为您节省一些时间。
它对我有用。 请参阅原始问题: https ://github.com/jaredpalmer/razzle/issues/356
// This will extract the env during production execution.. PORT will not be inlined during build
const getEnv = c => process.env[c];
app.listen(getEnv('PORT'));