Skip to content
This repository has been archived by the owner on Sep 14, 2020. It is now read-only.

Commit

Permalink
add Example()
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Jan 27, 2018
1 parent 4723867 commit 952421d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
3 changes: 1 addition & 2 deletions Readme.md
Expand Up @@ -15,9 +15,8 @@ import (
)

func main() {
addr := ":" + os.Getenv("PORT")
http.HandleFunc("/", hello)
log.Fatal(gateway.ListenAndServe(addr, nil))
log.Fatal(gateway.ListenAndServe(":3000", nil))
}

func hello(w http.ResponseWriter, r *http.Request) {
Expand Down
18 changes: 18 additions & 0 deletions gateway_test.go
@@ -0,0 +1,18 @@
package gateway_test

import (
"fmt"
"log"
"net/http"

"github.com/apex/gateway"
)

func Example() {
http.HandleFunc("/", hello)
log.Fatal(gateway.ListenAndServe(":3000", nil))
}

func hello(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Hello World from Go")
}

0 comments on commit 952421d

Please sign in to comment.