import type { APIRoute } from "astro";

export const GET: APIRoute = async () => {
  const isStaging = import.meta.env.MODE === "staging" || (import.meta.env.PORT === "3002");

  const body = isStaging
    ? `User-agent: *\nDisallow: /\n`
    : `User-agent: *\nAllow: /\nDisallow: /admin/\nDisallow: /api/\n\nSitemap: https://sneakerpicks.nl/sitemap.xml\n`;

  return new Response(body, {
    headers: { "Content-Type": "text/plain" },
  });
};
