Initial project import
This commit is contained in:
46
API.md
Normal file
46
API.md
Normal file
@@ -0,0 +1,46 @@
|
||||
# Inquiry Notification API
|
||||
|
||||
## Run
|
||||
|
||||
```bash
|
||||
npm run dev:full
|
||||
```
|
||||
|
||||
The API listens on `http://127.0.0.1:5174` by default, and Vite proxies `/api` to it.
|
||||
|
||||
## Configuration
|
||||
|
||||
```bash
|
||||
INQUIRY_NOTIFICATION_URL="https://notification.example.com/inquiries"
|
||||
INQUIRY_NOTIFICATION_AUTH_HEADER="Bearer optional-token"
|
||||
INQUIRY_ALLOWED_ORIGIN="https://www.wanderq.com"
|
||||
INQUIRY_API_PORT=5174
|
||||
INQUIRY_MAX_BODY_BYTES=100000
|
||||
```
|
||||
|
||||
The notification URL must be configured for inquiry submission to succeed. The API does not persist inquiry data locally.
|
||||
|
||||
## Endpoints
|
||||
|
||||
| Method | Path | Purpose |
|
||||
|--------|------|---------|
|
||||
| `GET` | `/api/health` | API health and notification configuration status |
|
||||
| `POST` | `/api/inquiries` | Validate an inquiry and forward it to the notification webhook |
|
||||
|
||||
### `POST /api/inquiries`
|
||||
|
||||
Required fields:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "Guest name",
|
||||
"contact": "guest@example.com",
|
||||
"interest": "Classic Guizhou landscapes",
|
||||
"travelMonth": "October 2026",
|
||||
"guests": "2",
|
||||
"message": "Additional notes",
|
||||
"locale": "en"
|
||||
}
|
||||
```
|
||||
|
||||
On success, the API returns `202` with an accepted inquiry receipt. It returns an error when the payload is invalid or the notification webhook is unavailable.
|
||||
Reference in New Issue
Block a user