API Documentation

← Back to News

Endpoints

GET /api/articles

List all articles, sorted by display order and creation date.

curl http://localhost:3000/api/articles

POST /api/articles

Create a new article with title, URL, and optional metadata.

Required Fields

  • title - The headline text
  • url - Link to the full article

Optional Fields

  • image_url - URL to article image
  • category - Article category (e.g., politics, tech, world)
  • is_breaking - Set to true for breaking news (red styling)
  • display_order - Sort order (lower = higher priority)
curl -X POST http://localhost:3000/api/articles \ -H "Content-Type: application/json" \ -d '{ "title": "Breaking: Major News Story Develops", "url": "https://example.com/news/story", "image_url": "https://example.com/image.jpg", "category": "politics", "is_breaking": true, "display_order": 1 }'

PATCH /api/articles/[id]

Update an existing article. Only include fields you want to change.

curl -X PATCH http://localhost:3000/api/articles/123 \ -H "Content-Type: application/json" \ -d '{ "title": "Updated Headline", "is_breaking": false }'

DELETE /api/articles/[id]

Delete an article by ID.

curl -X DELETE http://localhost:3000/api/articles/123

Response Format

All endpoints return JSON responses:

{ "id": "uuid", "title": "Article Title", "url": "https://example.com", "image_url": "https://example.com/image.jpg", "category": "politics", "is_breaking": false, "display_order": 0, "created_at": "2025-01-01T00:00:00Z" }

Notes

  • Replace localhost:3000 with your actual domain when deployed
  • Breaking news articles appear at the top with red styling and full-width images
  • Display order controls article priority (lower numbers appear first)
  • Articles without images will display text-only headlines
  • The homepage automatically refreshes to show new content