Create a gist now

Instantly share code, notes, and snippets.

@tj /main.go
Last active Apr 10, 2017

Embed
package main
import (
"fmt"
"net/http"
"github.com/apex/go-apex"
"github.com/apex/go-apex/proxy"
)
func main() {
h := http.NewServeMux()
h.HandleFunc("/hello", hello)
h.HandleFunc("/world", world)
apex.Handle(proxy.Serve(h))
}
func hello(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello")
}
func world(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "World")
}
@tj

This comment has been minimized.

Show comment
Hide comment
@tj

tj Mar 15, 2017

https://github.com/apex/go-apex

Lets you run regular net/http servers on AWS API Gateway via https://github.com/apex/apex with just apex.Handle(proxy.Serve(h)), or apex.Handle(proxy.Serve(nil)) for DefaultServeMux, otherwise everything else is normal.

Owner

tj commented Mar 15, 2017

https://github.com/apex/go-apex

Lets you run regular net/http servers on AWS API Gateway via https://github.com/apex/apex with just apex.Handle(proxy.Serve(h)), or apex.Handle(proxy.Serve(nil)) for DefaultServeMux, otherwise everything else is normal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment