From cc914d4799a5a80372fc8f5f9c73ab6223553fb7 Mon Sep 17 00:00:00 2001 From: qier222 Date: Sat, 25 Sep 2021 12:52:00 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E5=A2=9E=E5=8A=A0=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E5=88=B0vercel=E5=90=8Eapi=E8=B7=A8=E5=9F=9F=E7=9A=84=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- README.md | 25 +++++++++++++++++++------ vercel.example.json | 8 ++++++++ 3 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 vercel.example.json diff --git a/.gitignore b/.gitignore index a0a2c43..b96fe0f 100644 --- a/.gitignore +++ b/.gitignore @@ -30,4 +30,5 @@ NeteaseCloudMusicApi-master NeteaseCloudMusicApi-master.zip # Local Netlify folder -.netlify \ No newline at end of file +.netlify +vercel.json diff --git a/README.md b/README.md index ae7065c..8fbc7e6 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Electron 版本由 [@hawtim](https://github.com/hawtim) 和 [@qier222](https://github.com/qier222) 适配并维护,支持 macOS、Windows、Linux。 访问本项目的 [Releases](https://github.com/qier222/YesPlayMusic/releases) -页面下载安装包,或者访问 [镜像下载站 (大陆访问更快)](https://dl.qier222.com/YesPlayMusic/) 下载。 +页面下载安装包。 macOS 用户也可以通过 `brew install --cask yesplaymusic` 来安装。 @@ -54,13 +54,26 @@ macOS 用户也可以通过 `brew install --cask yesplaymusic` 来安装。 2. 点击本仓库右上角的 Fork,复制本仓库到你的 GitHub 账号。 -3. 打开 [Vercel.com](https://vercel.com),使用 GitHub 登录。 +3. 点击仓库的 Add File,选择 Create new file,输入 `vercel.json`,将下面的内容复制粘贴到文件中,并将 `https://your-netease-api.example.com` 替换为你刚刚部署的网易云 API 地址: -4. 点击 Import Git Repository 并选择你刚刚复制的仓库并点击 Import。 +```json +{ + "rewrites": [ + { + "source": "/api/:match*", + "destination": "https://your-netease-api.example.com/:match*" + } + ] +} +``` -5. 点击 PERSONAL ACCOUNT 旁边的 Select。 +4. 打开 [Vercel.com](https://vercel.com),使用 GitHub 登录。 -6. 点击 Environment Variables,填写 Name 为 `VUE_APP_NETEASE_API_URL`,Value 为你刚刚部署的网易云 API 地址,点击 Add。最后点击底部的 Deploy 就可以部署到 +5. 点击 Import Git Repository 并选择你刚刚复制的仓库并点击 Import。 + +6. 点击 PERSONAL ACCOUNT 旁边的 Select。 + +7. 点击 Environment Variables,填写 Name 为 `VUE_APP_NETEASE_API_URL`,Value 为 `/api`,点击 Add。最后点击底部的 Deploy 就可以部署到 Vercel 了。 ## ⚙️ 部署到自己的服务器 @@ -127,7 +140,7 @@ yarn run build ```shell # 安装依赖 -yarn +yarn install # 创建本地环境变量 cp .env.example .env diff --git a/vercel.example.json b/vercel.example.json new file mode 100644 index 0000000..26e819c --- /dev/null +++ b/vercel.example.json @@ -0,0 +1,8 @@ +{ + "rewrites": [ + { + "source": "/api/:match*", + "destination": "https://your-netease-api.example.com/:match*" + } + ] +}