Project Overview
`go_api_microservices` is a project developed in Go, utilizing Gin for handling routing and MongoDB for storing data. It offers API endpoints that allow data retrieval from the inventories and news collections. The data provided by these endpoints consist of simulated information about inventories from local food banks in Canada and news feeds.
- RESTful API endpoints to interact with MongoDB.
- Utilizes Gin web framework for routing.
- MongoDB integration using Go driver.
- Clean and structured codebase.
- Go (1.x or later)
- MongoDB
- Git
-
Clone the Repository
-
Set Up MongoDB
- Ensure MongoDB is running.
- Use the
inventories
andnews
collections.
-
Configure Environment Variables Create a
.env
file in the root with your MongoDB URI: -
Run the Application
-
Get Inventories:
GET /inventories
- Fetches documents from the
inventories
collection. - Supports optional query parameters
location
andcategory
for filtering.
- Fetches documents from the
-
Get News:
GET /news
- Retrieves documents from the
news
collection.
- Retrieves documents from the
-
Fetching inventories with filtering: curl "https://go-api-microservices.onrender.com/inventories?location=Scarborough&category=Beverages"
-
Fetching news: curl https://go-api-microservices.onrender.com/news
Contributions are welcome. To contribute:
- Fork the repository.
- Create a new branch (
git checkout -b my-new-feature
). - Commit your changes (
git commit -am 'Add some feature'
). - Push to the branch (
git push origin my-new-feature
). - Create a new Pull Request.