# API Quick Reference

## Base URL
```
http://localhost:1999
```

## Endpoints

### 🏠 Home Page
```bash
GET /?lang={en|es}
```
Full HTML page with CV content.

### 📄 CV Content (HTMX)
```bash
GET /cv?lang={en|es}
```
HTML partial for HTMX swaps.

### 📥 PDF Export
```bash
GET /export/pdf?lang={en|es}
```
Downloads PDF resume (~1.8 MB, takes ~3 seconds).

### ❤️ Health Check
```bash
GET /health
```
Returns JSON: `{"status": "ok", "timestamp": "...", "version": "1.0.0"}`

### 🎨 Static Files
```bash
GET /static/{path}
```
Serves CSS, JS, images with cache headers.

## Quick Tests

### Test All Endpoints
```bash
# Health
curl http://localhost:1999/health | jq

# Home (English)
curl "http://localhost:1999/?lang=en"

# Home (Spanish)
curl "http://localhost:1999/?lang=es"

# CV Content
curl "http://localhost:1999/cv?lang=en"

# PDF Export
curl -O -J "http://localhost:1999/export/pdf?lang=en"

# Static File
curl -I http://localhost:1999/static/css/main.css
```

### HTMX Language Switcher
```html
<button
  hx-get="/cv?lang=en"
  hx-target="#cv-content"
  hx-swap="innerHTML"
  hx-push-url="/?lang=en">
  English
</button>
```

## Error Codes

| Code | Meaning | Example |
|------|---------|---------|
| 200 | Success | All valid requests |
| 400 | Bad Request | `?lang=invalid` |
| 404 | Not Found | `/nonexistent` |
| 500 | Server Error | Template/data/PDF error |

## Performance

- **Health**: <1ms
- **HTML Pages**: 7-8ms
- **Static Files**: <5ms
- **PDF Export**: ~3 seconds

## Configuration (ENV)

```bash
PORT=1999
HOST=localhost
GO_ENV=development
READ_TIMEOUT=15
WRITE_TIMEOUT=15
```

## Security Headers

✅ Content-Security-Policy
✅ X-Frame-Options: SAMEORIGIN
✅ X-Content-Type-Options: nosniff
✅ Referrer-Policy
✅ Permissions-Policy
✅ HSTS (production only)

## Need More Details?

See [API.md](API.md) for complete documentation.
