News Fluss is a RESTful API built with Go and the Gin framework. This project provides endpoints to manage news articles, sources, and top headlines, allowing users to create, search, and retrieve news data.
news-fluss
├── main.go # Entry point of the application
├── go.mod # Module dependencies
├── go.sum # Module dependency checksums
├── README.md # Project documentation
├── controllers # HTTP request handlers
│ ├── news_controller.go
│ ├── sources_controller.go
│ └── headlines_controller.go
├── routes # API route definitions
│ └── news_routes.go
├── models # Data models for search parameters
│ ├── news.go # News search parameters (POST /news)
│ └── source.go # Source search parameters (POST /sources)
└── config # Configuration settings
└── config.go
-
Clone the repository:
git clone <repository-url> cd news-fluss
-
Initialize Go modules (if not already initialized):
go mod init
-
Install dependencies:
go get -u github.com/gin-gonic/gin go mod tidy
-
Run the application:
go run main.go
All available endpoints are defined in routes/news_routes.go
:
-
GET /news
Retrieve a list of news articles. -
POST /news
Search for news articles.
The request body should match the structure inmodels/news.go
(see Models below).
-
GET /topHeadlines
Retrieve top headlines. -
GET /topHeadlines/:category
Retrieve top headlines by category.
-
GET /sources
Retrieve a list of news sources. -
GET /sources/:category
Retrieve news sources by category. -
POST /sources
Search for news sources.
The request body should match the structure inmodels/source.go
(see Models below).
Data models for search parameters are defined in the models
folder:
models/news.go
– News search parameters forPOST /news
models/source.go
– Source search parameters forPOST /sources
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
This project is licensed under the MIT License.