diff --git a/apps/backend-mock/routes/[...].ts b/apps/backend-mock/routes/[...].ts index 5a22563dc..44038cf7c 100644 --- a/apps/backend-mock/routes/[...].ts +++ b/apps/backend-mock/routes/[...].ts @@ -3,13 +3,13 @@ import { defineEventHandler } from 'h3'; export default defineEventHandler(() => { return `

Hello Vben Admin

-

Mock service is starting

+

Mock service is running

`; }); diff --git a/docs/src/en/guide/essentials/server.md b/docs/src/en/guide/essentials/server.md index b17db80dd..3a863a33e 100644 --- a/docs/src/en/guide/essentials/server.md +++ b/docs/src/en/guide/essentials/server.md @@ -63,16 +63,18 @@ Based on the above configuration, we can use `/api` as the prefix for API reques ```ts import axios from 'axios'; -axios.get('/api/user').then((res) => { - console.log(res); -}); +axios + .post('/api/auth/login', { username: 'vben', password: '123456' }) + .then((res) => { + console.log(res); + }); ``` -At this point, the request will be proxied to `http://localhost:5320/api/user`. +At this point, the request will be proxied to `http://localhost:5320/api/auth/login`. ::: warning Note -From the browser's console Network tab, the request appears as `http://localhost:5555/api/user`. This is because the proxy configuration does not change the local request's URL. +From the browser's console Network tab, the request appears as `http://localhost:5555/api/auth/login`. This is because the proxy configuration does not change the local request's URL. ::: diff --git a/docs/src/guide/essentials/server.md b/docs/src/guide/essentials/server.md index 2ae16e763..b2ed79ba5 100644 --- a/docs/src/guide/essentials/server.md +++ b/docs/src/guide/essentials/server.md @@ -63,16 +63,18 @@ export default defineConfig(async () => { ```ts import axios from 'axios'; -axios.get('/api/user').then((res) => { - console.log(res); -}); +axios + .post('/api/auth/login', { username: 'vben', password: '123456' }) + .then((res) => { + console.log(res); + }); ``` -此时,请求会被代理到 `http://localhost:5320/api/user`。 +此时,请求会被代理到 `http://localhost:5320/api/auth/login`。 ::: warning 注意 -从浏览器控制台的 Network 看,请求是 `http://localhost:5555/api/user`, 这是因为 proxy 配置不会改变本地请求的 url。 +从浏览器控制台的 Network 看,请求是 `http://localhost:5555/api/auth/login`, 这是因为 proxy 配置不会改变本地请求的 url。 :::