GET /api/news
Retrieve a list of all news articles about Dzaleka Refugee Camp.Query Parameters
This endpoint does not require any query parameters.Response Format
Status of the API response (“success” or “error”)
Total number of news articles returned
Container for the news data
Array of news article objects
Unique identifier for the article
Collection name (“news”)
Article title
Article summary or excerpt
URL to article featured image
Author name
Whether the article is featured
Publication date (YYYY-MM-DD)
Article category (e.g., “business-spotlight”, “community-update”, “announcement”)
Error Responses
“error”
Error message description
Detailed error information
200- Success429- Rate limit exceeded (60 requests per minute)500- Internal server error
Rate Limiting
All API endpoints are rate-limited to 60 requests per minute per IP address. Rate limit headers are included in responses:X-RateLimit-Limit: Maximum requests per windowX-RateLimit-Remaining: Remaining requests in current windowX-RateLimit-Reset: Timestamp when the rate limit resetsRetry-After: Seconds to wait before retrying (only on 429 responses)
Example Request
Example Response
POST /api/news
Retrieve news data with optional metadata and statistics.Request Body
Response Format
Same as GET endpoint, with optional additional fields:Example Request
Example Response
Implementation
The News API is implemented using thecreateGetHandler and createPostHandler utility functions from src/utils/api-utils.ts:118.
Source code: src/pages/api/news.ts:5