cloudflare deployment

This commit is contained in:
2026-04-03 11:19:29 -04:00
parent 5dc33897ce
commit 84728c9532
9 changed files with 896 additions and 39 deletions

View File

@@ -70,7 +70,7 @@ function buildContactNotificationHtml(data: ContactBody): string {
</html>`;
}
export const POST: APIRoute = async ({ request }) => {
export const POST: APIRoute = async ({ request, locals }) => {
let body: unknown;
try {
body = await request.json();
@@ -88,7 +88,8 @@ export const POST: APIRoute = async ({ request }) => {
});
}
const apiKey = process.env.RESEND_API_KEY;
const runtime = (locals as { runtime?: { env?: Record<string, string> } }).runtime;
const apiKey = runtime?.env?.RESEND_API_KEY;
const toAddress = general.emailToContact?.trim();
const fromAddress = general.emailFromContact?.trim();
if (!apiKey || !toAddress || !fromAddress) {