diff options
| author | David Hill <[email protected]> | 2025-10-29 15:16:17 +0000 |
|---|---|---|
| committer | David Hill <[email protected]> | 2025-10-29 15:16:17 +0000 |
| commit | 7baa75135159907d4e28f82e1e9a22fe6ef7e6e1 (patch) | |
| tree | ac5f47615db1ef3b47931c5e9cfe4a92c592e940 /packages/console/app/src/routes/api | |
| parent | 5b86fa91099d66cdc876cd4209a97ae2c903d510 (diff) | |
| download | opencode-7baa75135159907d4e28f82e1e9a22fe6ef7e6e1.tar.gz opencode-7baa75135159907d4e28f82e1e9a22fe6ef7e6e1.zip | |
First pass at adding an enterprise page
Diffstat (limited to 'packages/console/app/src/routes/api')
| -rw-r--r-- | packages/console/app/src/routes/api/enterprise.ts | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/packages/console/app/src/routes/api/enterprise.ts b/packages/console/app/src/routes/api/enterprise.ts new file mode 100644 index 000000000..6298ae349 --- /dev/null +++ b/packages/console/app/src/routes/api/enterprise.ts @@ -0,0 +1,52 @@ +import type { APIEvent } from "@solidjs/start/server" +import { AWS } from "@opencode-ai/console-core/aws.js" + +interface EnterpriseFormData { + name: string + company: string + role: string + email: string + message: string +} + +export async function POST(event: APIEvent) { + try { + const body = (await event.request.json()) as EnterpriseFormData + + // Validate required fields + if (!body.name || !body.company || !body.role || !body.email || !body.message) { + return Response.json({ error: "All fields are required" }, { status: 400 }) + } + + // Validate email format + const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/ + if (!emailRegex.test(body.email)) { + return Response.json({ error: "Invalid email format" }, { status: 400 }) + } + + // Create email content + const emailContent = ` +New Enterprise Inquiry + +Name: ${body.name} +Company: ${body.company} +Role: ${body.role} +Email: ${body.email} + +Message: +${body.message} + `.trim() + + // Send email using AWS SES + await AWS.sendEmail({ + to: "[email protected]", + subject: `Enterprise Inquiry from ${body.company}`, + body: emailContent, + }) + + return Response.json({ success: true, message: "Form submitted successfully" }, { status: 200 }) + } catch (error) { + console.error("Error processing enterprise form:", error) + return Response.json({ error: "Internal server error" }, { status: 500 }) + } +} |
