Overview
The/api/confirmar endpoint handles RSVP confirmations for wedding guests. It accepts guest information via POST request and sends an email notification with the RSVP details using Nodemailer.
Endpoint
Request Parameters
The name of the guest confirming attendance. This field is required.
Attendance confirmation status. This field is required.
Any food allergies or dietary restrictions. This field is optional.
Response
Success Response
Indicates the RSVP was successfully processed and email was sent.
200 OK
Error Responses
Missing Required Fields
Error message describing the issue.
400 Bad Request
Server Error
Status Code:500 Internal Server Error
Examples
cURL
JavaScript/TypeScript
Fetch with Error Handling
Environment Variables
The endpoint requires the following environment variables to be configured:SMTP Configuration
The endpoint is configured to use IONOS SMTP service with the following settings:- Host:
smtp.ionos.es - Port:
587 - Secure:
false(uses STARTTLS)
Email Notification
When an RSVP is successfully submitted, an email is sent with the following details:- From: “Web Boda” <EMAIL_USER>
- To: EMAIL_TO
- Subject: “✉️ Confirmación de asistencia – [Guest Name]”
- Content: HTML formatted message with guest name, allergies, and attendance status
Error Handling
The endpoint implements comprehensive error handling:- Validation Errors (400): Returns when required fields (
nombreorasistencia) are missing - Server Errors (500): Returns when email sending fails or other unexpected errors occur
- All errors are logged to the console for debugging purposes
Implementation Notes
- The endpoint uses
prerender = falseto ensure it runs on the server - Built on Astro’s APIRoute type
- Uses Nodemailer for reliable email delivery
- All responses include proper
Content-Type: application/jsonheaders