Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modify example handler func name #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/gorilla/mux"
)

func handler(w http.ResponseWriter, r *http.Request) {
func handlerHook(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("WORLD!"))
}

Expand All @@ -24,7 +24,7 @@ func postSigUsr1() {

func main() {
mux1 := mux.NewRouter()
mux1.HandleFunc("/hello", handler).
mux1.HandleFunc("/hello", handlerHook).
Methods("GET")

srv := endless.NewServer("localhost:4244", mux1)
Expand Down
4 changes: 2 additions & 2 deletions examples/multi_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/gorilla/mux"
)

func handler(w http.ResponseWriter, r *http.Request) {
func handlerPort(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("WORLD!"))
}

Expand All @@ -26,7 +26,7 @@ func handlerBar(w http.ResponseWriter, r *http.Request) {

func main() {
mux1 := mux.NewRouter()
mux1.HandleFunc("/hello", handler).
mux1.HandleFunc("/hello", handlerPort).
Methods("GET")
mux1.HandleFunc("/foo", handlerFoo).
Methods("GET")
Expand Down
4 changes: 2 additions & 2 deletions examples/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import (
"github.com/gorilla/mux"
)

func handler(w http.ResponseWriter, r *http.Request) {
func handlerSimple(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("WORLD!"))
}

func main() {
mux1 := mux.NewRouter()
mux1.HandleFunc("/hello", handler).
mux1.HandleFunc("/hello", handlerSimple).
Methods("GET")

err := endless.ListenAndServe("localhost:4242", mux1)
Expand Down
4 changes: 2 additions & 2 deletions examples/testserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import (
"github.com/gorilla/mux"
)

func handler(w http.ResponseWriter, r *http.Request) {
func handlerTest(w http.ResponseWriter, r *http.Request) {
time.Sleep(time.Duration(rand.Intn(2000)) * time.Millisecond)
w.Write([]byte("bar\n"))
}

func main() {
// endless.DefaultHammerTime = 10*time.Second
mux := mux.NewRouter()
mux.HandleFunc("/foo", handler).
mux.HandleFunc("/foo", handlerTest).
Methods("GET")

err := endless.ListenAndServe("localhost:4242", mux)
Expand Down
4 changes: 2 additions & 2 deletions examples/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (
"github.com/gorilla/mux"
)

func handler(w http.ResponseWriter, r *http.Request) {
func handlerTls(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("WORLD!"))
}

func main() {
mux1 := mux.NewRouter()
mux1.Schemes("https")
mux1.HandleFunc("/hello", handler).
mux1.HandleFunc("/hello", handlerTls).
Methods("GET")

err := endless.ListenAndServeTLS("localhost:4242", "cert.pem", "key.pem", mux1)
Expand Down
8 changes: 8 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module endless

go 1.13

require (
github.com/fvbock/endless v0.0.0-20170109170031-447134032cb6
github.com/gorilla/mux v1.7.3
)