feat:接口联调
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
export default defineEventHandler((event) => {
|
||||
const config = useRuntimeConfig()
|
||||
const targetBase = String(config.officialApiProxyTarget || 'http://localhost:8080').replace(/\/$/, '')
|
||||
const rawPath = event.context.params?.path || ''
|
||||
const path = Array.isArray(rawPath) ? rawPath.join('/') : rawPath
|
||||
const requestUrl = getRequestURL(event)
|
||||
const targetUrl = `${targetBase}/api/${path}${requestUrl.search}`
|
||||
|
||||
return proxyRequest(event, targetUrl)
|
||||
})
|
||||
Reference in New Issue
Block a user