Write your HTTP application in Go once, deploy it* to your servers and AWS Lambda. Really, it's a drop-in replacement for net/http.
*: it must be compiled as GOOS=linux
to be deployed in AWS Lambda.
Alpha quality. It needs to be tested out extensively but it seems to work fine.
go get github.com/imdario/gluo
import (
"github.com/imdario/gluo"
)
Just call gluo.ListenAndServe
instead of http.ListenAndServe
.
package main
import (
"github.com/imdario/gluo"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello from Gluo"))
}
func main() {
gluo.ListenAndServe(":3000", http.HandlerFunc(handler))
}
Here are some similar projects, although they don't allow to deploy the same binary to servers and AWS Lambda.
If I can help you, you have an idea or you are using Gluo in your projects, don't hesitate to drop me a line (or a pull request): @im_dario
Written by Dario Castañé.
BSD 3-Clause license.
Hey dude! Help me out for a couple of 🍻!