2026-07-21 11:09:17 +08:00
|
|
|
export default defineEventHandler((event) => {
|
|
|
|
|
const config = useRuntimeConfig()
|
2026-07-24 18:55:51 +08:00
|
|
|
const targetBase = String(config.officialApiProxyTarget).replace(/\/$/, '')
|
2026-07-21 11:09:17 +08:00
|
|
|
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)
|
|
|
|
|
})
|