ThisaraWeerakoon opened a new pull request, #6: URL: https://github.com/apache/synapse-go/pull/6
**Description** This PR adds API handling capabilities to the Synapse Go implementation, including a flexible HTTP router with versioning support, robust validation, and graceful shutdown handling. **Features** * Dynamic HTTP routing based on API definitions * Support for multiple versioning strategies (Context version strategy and URL version strategy ) * Comprehensive API validation for context and version configuration * Automatic server lifecycle management with graceful shutdown * Proper error handling throughout the request/response pipeline * Thorough unit tests for all new functionality **Implementation Details** **API Routing** * Added a new `RouterService` in the `internal/pkg/core/router` package. * Implemented dynamic route registration based on API resources. * Added support for HTTP method filtering in route handlers. * Integrated API context and versioning in the URL path construction. **API Validation** * Enhanced API unmarshaling to validate mandatory fields (context, name). * Added validation for context format (must start with '/'). * Implemented version and versionType consistency validation. * Added proper versioning type validation ("url" or "context"). **Server Lifecycle** * Implemented automatic HTTP server startup when APIs are registered. * Added context-based graceful shutdown mechanism. * Proper cleanup of resources during shutdown. **Additional Changes** * Updated deployment process to register APIs with the router. * Enhanced message context with request handling capabilities. * Added documentation in the README. **Testing** The implementation includes comprehensive tests for: * API routing and request handling * Versioning strategies (URL and context-based) * API validation for different scenarios * Edge cases like placeholder handling, trailing slashes This feature allows Synapse Go to handle API definitions in a way that's consistent with the original Apache Synapse, providing a solid foundation for RESTful API management. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@synapse.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@synapse.apache.org For additional commands, e-mail: dev-h...@synapse.apache.org