// Proxy all requests to the API to the configured API base URL.
// See https://www.youtube.com/watch?v=J4E5uYz5AY8
import { joinURL } from 'ufo'
export default defineEventHandler(async (event) => {
const proxyUrl = useRuntimeConfig().apiBaseUrl
const path = event.path.replace(/^\/api\//, '')
const target = joinURL(proxyUrl, path)
return proxyRequest(event, target)
})
// Proxy all requests to the API to the configured API base URL.
// See https://www.youtube.com/watch?v=J4E5uYz5AY8
import { joinURL } from 'ufo'
export default defineEventHandler(async (event) => {
const proxyUrl = useRuntimeConfig().apiBaseUrl
const path = event.path.replace(/^\/api\//, '')
const target = joinURL(proxyUrl, path)
return proxyRequest(event, target)
})