提交 5951985e 编写于 作者: B binaryify

修改默认绑定 HOST #620

上级 641a72b0
# 更新日志 # 更新日志
### 3.24.2 | 2019.10.28
- 修改默认绑定 HOST [#620](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/620)
### 3.24.1 | 2019.10.25 ### 3.24.1 | 2019.10.25
- 修改默认绑定 HOST [#615](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/615) - 修改默认绑定 HOST [#615](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/615)
......
...@@ -83,10 +83,10 @@ fs.readdirSync(path.join(__dirname, 'module')).reverse().forEach(file => { ...@@ -83,10 +83,10 @@ fs.readdirSync(path.join(__dirname, 'module')).reverse().forEach(file => {
}) })
const port = process.env.PORT || 3000 const port = process.env.PORT || 3000
const host = process.env.HOST || '127.0.0.1' const host = process.env.HOST || ''
app.server = app.listen(port, host, () => { app.server = app.listen(port, host, () => {
console.log(`server running @ http://${host}:${port}`) console.log(`server running @ http://${host ? host : 'localhost'}:${port}`)
}) })
module.exports = app module.exports = app
...@@ -181,14 +181,14 @@ windows 下使用 git-bash 或者 cmder 等终端执行以下命令 : ...@@ -181,14 +181,14 @@ windows 下使用 git-bash 或者 cmder 等终端执行以下命令 :
$ set PORT=4000 && node app.js $ set PORT=4000 && node app.js
``` ```
服务器启动绑定 127.0.0.1,如果需要更改, 可使用以下命令 : Mac/Linux 服务器启动默认 host 为localhost,如果需要更改, 可使用以下命令 : Mac/Linux
```shell ```shell
$ HOST=localhost node app.js $ HOST=127.0.0.1 node app.js
``` ```
windows 下使用 git-bash 或者 cmder 等终端执行以下命令 : windows 下使用 git-bash 或者 cmder 等终端执行以下命令 :
```shell ```shell
$ set HOST=localhost && node app.js $ set HOST=127.0.0.1 && node app.js
``` ```
## 可以使用代理 ## 可以使用代理
......
{ {
"name": "NeteaseCloudMusicApi", "name": "NeteaseCloudMusicApi",
"version": "3.24.1", "version": "3.24.2",
"description": "网易云音乐 NodeJS 版 API", "description": "网易云音乐 NodeJS 版 API",
"scripts": { "scripts": {
"start": "node app.js", "start": "node app.js",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册