diff --git a/src/routes/api/[...path]/+server.js b/src/routes/api/[...path]/+server.js new file mode 100644 index 0000000..518adc1 --- /dev/null +++ b/src/routes/api/[...path]/+server.js @@ -0,0 +1,9 @@ +export async function GET({ params, url }) { + const res = await fetch(`http://37100lab.it:8101/api/${params.path}${url.search}`); + return new Response(res.body, { + status: res.status, + headers: { + 'content-type': res.headers.get('content-type') ?? 'application/json', + }, + }); +} diff --git a/vite.config.ts b/vite.config.ts index 81936db..fce9e87 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -3,9 +3,4 @@ import { defineConfig } from 'vite'; export default defineConfig({ plugins: [sveltekit()], - server: { - proxy: { - '/api': 'http://37100lab.it:8101', - }, - }, });