0e52d625a1
- Removed redundant API documentation (API.md and API-QUICK-REFERENCE.md) - Added cv-app binary to gitignore to prevent committing build artifacts
1.8 KiB
1.8 KiB
API Quick Reference
Base URL
http://localhost:1999
Endpoints
🏠 Home Page
GET /?lang={en|es}
Full HTML page with CV content.
📄 CV Content (HTMX)
GET /cv?lang={en|es}
HTML partial for HTMX swaps.
📥 PDF Export
GET /export/pdf?lang={en|es}
Downloads PDF resume (~1.8 MB, takes ~3 seconds).
❤️ Health Check
GET /health
Returns JSON: {"status": "ok", "timestamp": "...", "version": "1.0.0"}
🎨 Static Files
GET /static/{path}
Serves CSS, JS, images with cache headers.
Quick Tests
Test All Endpoints
# 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
<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)
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 for complete documentation.