A user-friendly tool for real-time tracking of infrastructure release versions and environment health status. It checks the health of environments in real-time from the PostgreSQL database.
1
stars
0
forks
source link
Consolidate Backend Services under a Single Entry Point and Port #6
Goal:
To streamline backend services by consolidating them under a single entry point at localhost:8080/api, with unified Swagger documentation for all endpoints. This setup will improve maintainability, reduce redundancy, and provide a cohesive API structure.
Description:
This issue focuses on consolidating backend services so they can be run from a single entry point at localhost:8080, accessed via /api. This includes the integration of a single Swagger documentation UI for all services and necessary refactoring to ensure maintainability, consistent naming, and modular route management.
Tasks:
Unify Entry Point and Port:
Refactor main.go to host all backend services (Company, Infra Types, Internal Env Details) from a single entry point at localhost:8080.
Group all API routes under /api for a unified API structure.
Swagger Documentation Integration:
Set up Swagger documentation for all services in a consolidated UI, accessible at localhost:8080/swagger.
Annotate handler functions in each service with Swagger documentation comments to provide clear descriptions, parameters, and response structures.
Ensure all endpoints from each service (Company, Infra Types, Internal Env Details) appear in the single Swagger UI for easy navigation and testing.
Dynamic Product Validation:
Refactor the Internal Env Details service to dynamically fetch the list of valid products from the database.
Add a repository function to retrieve products and update handler logic for validation, replacing hardcoded lists.
Standardize Repository Method Names:
Update the method Getcompany in the Company service repository to GetCompany to follow Go naming conventions and avoid case-sensitive issues.
Centralized CORS and Middleware:
Implement centralized CORS and middleware configuration in main.go to handle cross-origin requests and reduce redundant configurations.
Modularized Route Setup:
Create Setup*Routes functions for each service to keep routing logic modular and organized by service.
Acceptance Criteria:
All services are accessible under a single API endpoint, localhost:8080/api, with clear paths for each service.
Swagger documentation is available at localhost:8080/swagger, listing all endpoints from all services.
Dynamic product validation is functional, with product names fetched from the database in the Internal Env Details service.
Repository methods are consistently named (e.g., GetCompany in Company service).
CORS and middleware configurations are centralized in main.go.
Route setup functions for each service are modular and maintain separation of concerns.
Final Commit Message (linked to this issue)
Once this issue is complete, refer to the issue number in the commit:
feat: Consolidate backend services to run under a single entry point on port 8080
Resolves #[ISSUE_NUMBER]
- Refactored backend services to be accessible from a single `main.go` file
- Unified API entry point at `localhost:8080/api` for all services (Company, Infra Types, Internal Env Details)
- Integrated centralized CORS configuration and middleware in `main.go`
- Enabled consolidated Swagger documentation for all services at `/swagger`
- Added dynamic product validation in Internal Env Details service by fetching valid products from the database
- Refactored Company service repository method `Getcompany` to `GetCompany` for consistency
- Modularized route setup by adding dedicated `Setup*Routes` functions for each service
These changes consolidate the API structure, reduce redundancy, and improve maintainability while providing a single, accessible Swagger UI.
Epic: #5
Goal:
To streamline backend services by consolidating them under a single entry point at
localhost:8080/api
, with unified Swagger documentation for all endpoints. This setup will improve maintainability, reduce redundancy, and provide a cohesive API structure.Description:
This issue focuses on consolidating backend services so they can be run from a single entry point at
localhost:8080
, accessed via/api
. This includes the integration of a single Swagger documentation UI for all services and necessary refactoring to ensure maintainability, consistent naming, and modular route management.Tasks:
Unify Entry Point and Port:
main.go
to host all backend services (Company, Infra Types, Internal Env Details) from a single entry point atlocalhost:8080
./api
for a unified API structure.Swagger Documentation Integration:
localhost:8080/swagger
.Dynamic Product Validation:
Standardize Repository Method Names:
Getcompany
in the Company service repository toGetCompany
to follow Go naming conventions and avoid case-sensitive issues.Centralized CORS and Middleware:
main.go
to handle cross-origin requests and reduce redundant configurations.Modularized Route Setup:
Setup*Routes
functions for each service to keep routing logic modular and organized by service.Acceptance Criteria:
localhost:8080/api
, with clear paths for each service.localhost:8080/swagger
, listing all endpoints from all services.GetCompany
in Company service).main.go
.Final Commit Message (linked to this issue)
Once this issue is complete, refer to the issue number in the commit: