awslabs / aws-lambda-go-api-proxy

lambda-go-api-proxy makes it easy to port APIs written with Go frameworks such as Gin (https://gin-gonic.github.io/gin/ ) to AWS Lambda and Amazon API Gateway.
Apache License 2.0
1.05k stars 197 forks source link

Add adapter for the `http.Handler` interface #17

Closed pirfalt closed 5 years ago

pirfalt commented 6 years ago

Issue #18

Description of changes:

Add a new HandlerAdapter for the http.HandlerFunc interface.

This is a general interface which all the other concrete adapter sources already implements. In addition to, example https://github.com/grpc-ecosystem/grpc-gateway and the go standard library.

Any of them could delegate to this adapter if they wanted to.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

leesio commented 5 years ago

This seems like a no brainer to me. I don't really understand why there's a HandlerFunc adapter and not a Handler adapter. AHandler adapter is more closely aligned with the other adapters as it allows the use of the http.ServeMux as a multiplexer.