50 lines
978 B
Markdown
50 lines
978 B
Markdown
# DeepLite BFF Server
|
|
|
|
Backend-for-Frontend proxy server for the DeepLite PWA.
|
|
|
|
## Configuration
|
|
|
|
Create a `.env` file:
|
|
|
|
```env
|
|
DEEPL_AUTH_KEY=your-deepl-api-key
|
|
BEARER_TOKEN=your-secure-token
|
|
PORT=8000
|
|
```
|
|
|
|
## API Endpoints
|
|
|
|
### POST /translate
|
|
|
|
Translates text using the DeepL API.
|
|
|
|
```bash
|
|
curl -X POST http://localhost:8000/translate \
|
|
-H "Authorization: Bearer YOUR_BEARER_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"text": "Hello world!", "target_lang": "FR"}'
|
|
```
|
|
|
|
**Parameters:**
|
|
|
|
- `text` (required): Text to translate
|
|
- `target_lang` (required): Target language code (e.g., "FR", "DE", "ES")
|
|
- `source_lang` (optional): Source language code (auto-detected if not provided)
|
|
|
|
### GET /languages
|
|
|
|
Retrieves the list of supported languages.
|
|
|
|
```bash
|
|
curl http://localhost:8000/languages \
|
|
-H "Authorization: Bearer YOUR_BEARER_TOKEN"
|
|
```
|
|
|
|
### GET /health
|
|
|
|
Health check endpoint (no authentication required).
|
|
|
|
```bash
|
|
curl http://localhost:8000/health
|
|
```
|