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

Generalize adapters #18

Closed pirfalt closed 5 years ago

pirfalt commented 6 years ago

chi.Mux, gin.Engine, gorillamux.Router, http.HandlerFunc and negroni.Negroni all implements the http.Handler interface, and all there adapter files are strikingly similar. All the adapters could probably be replaced with a single adapter which takes that http.Handler interface instead of the concrete implementations.

Which I noticed after opening #17 which adds this to only the handlerfunc package a new httpadapter package. (Which all others could delegate to).

sapessi commented 5 years ago

PR merged. Closing issue. Thanks for the contribution @pirfalt and apologies for the delay!

kyleyost19 commented 5 years ago

To this point being made @pirfalt , you can just remove the gorillamux and handlerfunc packages. You simply cast them to an http.Handler when you instantiate your Handler package with Handler.New().