How fazeelbhatti/dawn-news-api works
Project type and purpose
• This is a Go-based HTTP API service (“Dawn News Web Scraper API”) built with the Gin framework. It exposes endpoints for “latest news” and “article by ID,” scraping Dawn.com on demand via the Colly library. It’s packaged in Docker, with a Cloud Build config for CI/CD and Swagger for docs.
File structure
• Top-level artifacts
• main.go – application entrypoint, Gin router setup
• controllers/ – HTTP handlers for “latest-news” and “article/:id”
• models/ – data structures for articles and article details
• docs/ – Swagger spec (swagger.json/yaml), auto-generated docs.go
• Dockerfile & cloudbuild.yaml – containerization & CI/CD
• go.mod/go.sum – dependency management
• No explicit database directory, so scraping and in-memory models serve responses.
• The MVC-ish separation: controllers → models → response JSON; docs plugged via Swagger middleware.
Insights from README
• Two endpoints under /api/v1/ serve JSON payloads.
• Uses Gin for routing, Colly for scraping Dawn.com.
• Docker image built and run; Cloud Build handles build/push/deploy.
• Swagger UI hosted under /swagger/index.html.