1
0
mirror of https://github.com/bingohuang/docker-labs.git synced 2025-07-14 01:57:32 +08:00

Add ping handler and listen on tcp4 addresses

This commit is contained in:
Marcos Lilljedahl 2016-10-08 03:26:22 +02:00
parent dde49d8700
commit 0d693b344c
2 changed files with 8 additions and 1 deletions

3
api.go
View File

@ -14,6 +14,7 @@ import (
func main() {
mux := bone.New()
mux.Get("/ping", http.HandlerFunc(handlers.Ping))
mux.Get("/", http.HandlerFunc(handlers.NewSession))
mux.Get("/sessions/:sessionId", http.HandlerFunc(handlers.GetSession))
mux.Post("/sessions/:sessionId/instances", http.HandlerFunc(handlers.NewInstance))
@ -30,6 +31,6 @@ func main() {
n := negroni.Classic()
n.UseHandler(mux)
log.Fatal(http.ListenAndServe(":3000", n))
log.Fatal(http.ListenAndServe("0.0.0.0:3000", n))
}

6
handlers/ping.go Normal file
View File

@ -0,0 +1,6 @@
package handlers
import "net/http"
func Ping(rw http.ResponseWriter, req *http.Request) {
}