Last active
April 10, 2017 06:58
-
-
Save tj/c686c586e2814b354d7225daf48403e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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))
, orapex.Handle(proxy.Serve(nil))
forDefaultServeMux
, otherwise everything else is normal.