This commit is contained in:
Chteufleur 2016-05-31 22:07:59 +02:00
commit 77752651e1
1 changed files with 7 additions and 2 deletions

View File

@ -19,6 +19,9 @@ const (
DOMAIN_ACCESS = "domain"
TRANSACTION_ID = "transaction_id"
ROUTE_ROOT = "/"
ROUTE_AUTH = "/toto"
RETURN_VALUE_OK = "OK"
RETURN_VALUE_NOK = "NOK"
)
@ -62,6 +65,7 @@ func authHandler(w http.ResponseWriter, r *http.Request) {
if answer {
ret = RETURN_VALUE_OK
}
// TODO reply with JSON format
fmt.Fprintf(w, ret)
}
@ -69,8 +73,9 @@ func authHandler(w http.ResponseWriter, r *http.Request) {
func Run() {
log.Printf("%sRunning", LogInfo)
http.HandleFunc("/", indexHandler) // set router
http.HandleFunc("/toto", authHandler)
http.HandleFunc(ROUTE_ROOT, indexHandler)
http.HandleFunc(ROUTE_AUTH, authHandler)
port := strconv.Itoa(HttpPortBind)
log.Printf("%sListenning on port %s", LogInfo, port)