Skip to content

Commit

Permalink
axios 相关代码调整, 腾讯云 serverless 部署文档说明
Browse files Browse the repository at this point in the history
  • Loading branch information
Binaryify committed Jan 18, 2023
1 parent d73effd commit 8743e21
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 7 deletions.
16 changes: 16 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,22 @@ v4.0.8 加入了 Vercel 配置文件,可以直接在 Vercel 下部署了,不需
5. 直接点`Continue`
6. `PROJECT NAME`自己填,`FRAMEWORK PRESET``Other` 然后直接点 `Deploy` 接着等部署完成即可

## 腾讯云 serverless 部署
`Vercel` 在国内访问太慢,在此提供腾讯云 serverless 部署方法
### 操作方法
1. fork 此项目
2. 在腾讯云serverless应用管理页面(https://console.cloud.tencent.com/sls),点击`新建应用`
3. 顶部`创建方式`选择 `Web 应用`
4. 选择 `Express框架`,点击底部`下一步按钮`
5. 输入`应用名`,上传方式选择`代码仓库`,进行GitHub授权(如已授权可跳过这一步),代码仓库选择刚刚fork的项目
6. 启动文件填入:
```
#!/bin/bash
export PORT=9000
/var/lang/node16/bin/node app.js
```
7. 点击`完成`,等待部署完成,点击`资源列表``API网关` 里的 `URL`,正常情况会打开文档地址,点击文档`例子`可查看接口调用效果

## 可以在Node.js调用

v3.31.0后支持Node.js调用,导入的方法为`module`内的文件名,返回内容包含`status``body`,`status`为状态码,`body`为请求返回内容,参考`module_example` 文件夹下的 `test.js`
Expand Down
17 changes: 17 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,23 @@ v4.0.8 加入了 Vercel 配置文件,可以直接在 Vercel 下部署了,不需
5. 直接点`Continue`
6. `PROJECT NAME`自己填,`FRAMEWORK PRESET``Other` 然后直接点 `Deploy` 接着等部署完成即可


## 腾讯云 serverless 部署
`Vercel` 在国内访问太慢,在此提供腾讯云 serverless 部署方法
### 操作方法
1. fork 此项目
2. 在腾讯云serverless应用管理页面(https://console.cloud.tencent.com/sls),点击`新建应用`
3. 顶部`创建方式`选择 `Web 应用`
4. 选择 `Express框架`,点击底部`下一步按钮`
5. 输入`应用名`,上传方式选择`代码仓库`,进行GitHub授权(如已授权可跳过这一步),代码仓库选择刚刚fork的项目
6. 启动文件填入:
```
#!/bin/bash
export PORT=9000
/var/lang/node16/bin/node app.js
```
7. 点击`完成`,等待部署完成,点击`资源列表``API网关` 里的 `URL`,正常情况会打开文档地址,点击文档`例子`可查看接口调用效果

## 可以使用代理

在 query 参数中加上 proxy=your-proxy 即可让这一次的请求使用 proxy
Expand Down
2 changes: 1 addition & 1 deletion plugins/songUpload.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const axios = require('axios')
const { default: axios } = require('axios')
module.exports = async (query, request) => {
let ext = 'mp3'
if (query.songFile.name.indexOf('flac') > -1) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/upload.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const axios = require('axios')
const { default: axios } = require('axios')
module.exports = async (query, request) => {
const data = {
bucket: 'yyimgs',
Expand Down
3 changes: 3 additions & 0 deletions scf_bootstrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
export PORT=9000
/var/lang/node16/bin/node app.js
2 changes: 1 addition & 1 deletion test/album.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const assert = require('assert')
const axios = require('axios')
const { default: axios } = require('axios')
const host = global.host || 'http://localhost:3000'
const config = require('../util/config.json')
describe('测试获取歌手专辑列表是否正常', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/comment.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const assert = require('assert')
const axios = require('axios')
const { default: axios } = require('axios')
const host = global.host || 'http://localhost:3000'
const config = require('../util/config.json')
describe('测试获取评论是否正常', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/lyric.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const assert = require('assert')
const axios = require('axios')
const { default: axios } = require('axios')
const host = global.host || 'http://localhost:3000'
const config = require('../util/config.json')
describe('测试获取歌词是否正常', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/music_url.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const assert = require('assert')
const axios = require('axios')
const { default: axios } = require('axios')
const host = global.host || 'http://localhost:3000'
const config = require('../util/config.json')
describe('测试获取歌曲是否正常', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/search.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const assert = require('assert')
const axios = require('axios')
const { default: axios } = require('axios')
const host = global.host || 'http://localhost:3000'
const config = require('../util/config.json')
describe('测试搜索是否正常', () => {
Expand Down

0 comments on commit 8743e21

Please sign in to comment.