import { b as private_env } from './shared-server-DaWdgxVh.js';

const GET = async ({ params, url, request, fetch }) => {
  const path = params["path"] ?? "";
  if (!private_env.TELESCOPE_BASE_URL) {
    return new Response(JSON.stringify({ error: "TELESCOPE_BASE_URL is not set" }), { status: 500 });
  }
  const targetUrl = `${private_env.TELESCOPE_BASE_URL}/${path}${url.search}`;
  const resp = await fetch(targetUrl, {
    headers: { authorization: `Bearer ${private_env.TELESCOPE_API_KEY}` }
  });
  return new Response(resp.body, { status: resp.status, headers: resp.headers });
};
const OPTIONS = async () => new Response(null, {
  status: 204,
  headers: {
    "Access-Control-Allow-Origin": "*",
    "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
    "Access-Control-Allow-Headers": "Content-Type, Authorization"
  }
});

export { GET, OPTIONS };
//# sourceMappingURL=_server.ts-B56wS_0L.js.map
