Skip to content

Commit

Permalink
feat: 请求增加/api前缀
Browse files Browse the repository at this point in the history
  • Loading branch information
lovezhangchuangxin committed Nov 8, 2024
1 parent a48509c commit 23ef779
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 40 deletions.
38 changes: 0 additions & 38 deletions Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion packages/api/src/req.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { DafaultRequestMethod, ResponseData } from './types'

// 创建 axios 实例
export const instance = axios.create({
baseURL: `http://localhost:${(import.meta as any).GAME_PORT || 7788}`,
baseURL: `http://localhost:${(import.meta as any).GAME_PORT || 7788}/api`,
timeout: 10000,
})

Expand Down
4 changes: 3 additions & 1 deletion packages/backend/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import KoaRouter from 'koa-router'
import userRouter from './user'

const routes = [userRouter]
const router = new KoaRouter()
const router = new KoaRouter({
prefix: '/api',
})

routes.forEach((route) => {
router.use(route.routes(), route.allowedMethods())
Expand Down

0 comments on commit 23ef779

Please sign in to comment.