File tree 5 files changed +51
-10
lines changed
5 files changed +51
-10
lines changed Original file line number Diff line number Diff line change 35
35
username : ' deploy'
36
36
host : ' ${{ vars.EMPTY_POINT_REMOTE_HOST }}'
37
37
key : ${{ secrets.EMPTY_POINT_REMOTE_KEY }}
38
- script : |
39
- cd /home/deploy/empty-point/next-js-app
40
- npm install
41
- npx prisma generate
42
- npx prisma migrate deploy
43
- npm run build
44
- pm2 stop "empty-point"; pm2 delete "empty-point"; pm2 start npm --name "empty-point" -- start
38
+ script : " sh /home/deploy/empty-point/start.sh"
45
39
Original file line number Diff line number Diff line change 5
5
6
6
@app .get ("/hello" )
7
7
async def hello ():
8
- return " hello world!"
8
+ return ' hello world!'
9
9
10
10
11
11
if __name__ == '__main__' :
Original file line number Diff line number Diff line change 1
- import axios from "axios " ;
1
+ import http from "@/lib/http " ;
2
2
3
3
export default function Home ( ) {
4
- const hello = axios . get ( 'http://localhost:3000 /api/fast-api-app/hello' )
4
+ const hello = http . get ( '/api/fast-api-app/hello' )
5
5
. then ( response => JSON . stringify ( response . data ) )
6
6
. catch ( error => {
7
7
console . log ( error )
Original file line number Diff line number Diff line change
1
+ import axios from "axios" ;
2
+
3
+ const http = axios . create ( {
4
+ baseURL : process . env . BASE_URL ,
5
+ timeout : 10000
6
+ } ) ;
7
+
8
+ http . interceptors . request . use (
9
+ config => {
10
+ // 处理请求前的逻辑...
11
+
12
+ return config
13
+ } ,
14
+ error => {
15
+ // 请求错误处理
16
+
17
+ return Promise . reject ( error )
18
+ }
19
+ ) ;
20
+
21
+ http . interceptors . response . use (
22
+ response => {
23
+ // 处理响应数据
24
+
25
+ return response
26
+ } ,
27
+ error => {
28
+ // 处理响应错误
29
+
30
+ return Promise . reject ( error )
31
+ }
32
+ ) ;
33
+
34
+ export default http ;
Original file line number Diff line number Diff line change
1
+ cd /home/deploy/empty-point/fast-api-app
2
+ python -m venv ./
3
+ source bin/active
4
+ pip install -r requirements.txt
5
+ pm2 stop " fast-api-app" ; pm2 delete " fast-api-app" ; pm2 start main.py --name " fast-api-app"
6
+ deactive
7
+
8
+ cd /home/deploy/empty-point/next-js-app
9
+ npm install
10
+ npx prisma generate
11
+ npx prisma migrate deploy
12
+ npm run build
13
+ pm2 stop " empty-point" ; pm2 delete " empty-point" ; pm2 start npm --name " empty-point" -- start
You can’t perform that action at this time.
0 commit comments