This project is an example of data persistence that makes a request to an external API and records the data in MongoDB. This data can be consulted from two Get routes.
To install the service you will need to have DB Mongo installed and running on your machine or remotely and create the database and collections mentioned below.
If you don't have mongo installed follow these steps: https://www.mongodb.com/docs/manual/administration/install-community/
V1.16
Runing project:
go mod vendor
go run main.go
Create database in mongo with collection:
db = sport
collection = news_information
Testing Route:
http://localhost:8080/v1/apipopulate-test
Get Many News:
http://localhost:8080/v1/api/news
Get One News:
http://localhost:8080/v1/api/news/:id
MONGODB_URI="mongodb://{host}:{port}"
go run main.go populate-news