So I made a new project using the astro template.
I add in pages/api and index file that exposes and endpoint POST /api..
I have cloudflare adapter, I have SSR and output server Here is my astro.config.mjs
` astro.config.mjs:
// @ts-check
import { defineConfig, envField } from "astro/config";
import mdx from "@astrojs/mdx";
import sitemap from "@astrojs/sitemap";
import cloudflare from "@astrojs/cloudflare";
import react from '@astrojs/react';
import tailwindcss from "@tailwindcss/vite";
// https://astro.build/config
export default defineConfig({
site: "https://gmconsultinglabs.com",
integrations: [mdx(), sitemap(), react()],
output: 'server',
adapter: cloudflare(),
vite: {
plugins: [
// Use JSDoc to cast the plugin to 'any' in a .mjs file
/** @type {any} */ (tailwindcss())
],
ssr: {
external: ['cloudflare:workers'],
},
},
env: {
schema: {
RESEND_API_KEY: envField.string({ access: "secret", context: "server" }),
TURNSTILE_SECRET: envField.string({ access: "secret", context: "server" }),
PUBLIC_TURNSTILE_SITE_KEY: envField.string({ access: "public", context: "client" }),
EMAIL_RECIPIENTS: envField.string({ access: "secret", context: "server" }),
}
},
server: {
headers: {
"Content-Security-Policy": "default-src 'self';img-src 'self' data: images.unsplash.com ;script-src 'self' https://challenges.cloudflare.com 'unsafe-inline'; frame-src https://challenges.cloudflare.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;font-src 'self' https://fonts.gstatic.com; "
}
}
});
`
the deploy script is: "deploy": "wrangler deploy",
All LLMs say that this should be deleted but I don't understand since I'm using the template and the settings provided by CF.
Any input would be very helpful!