Update main.go
This commit is contained in:
parent
1abb1d60e7
commit
d7d8bf4b20
16
main.go
16
main.go
@ -18,7 +18,8 @@ func sayhelloName(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Println("key:", k)
|
||||
fmt.Println("val:", strings.Join(v, ""))
|
||||
}
|
||||
fmt.Fprintf(w, "Hello astaxie!")
|
||||
fmt.Fprintf(w, "Witaj, aby przejść do panelu logowania przejdź odpowiednio do Login!")
|
||||
fmt.Println("path", r.URL.Path, w, "/login")
|
||||
}
|
||||
|
||||
func login(w http.ResponseWriter, r *http.Request) {
|
||||
@ -33,9 +34,22 @@ func login(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
func panel(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Println("method:", r.Method)
|
||||
if r.Method == "GET" {
|
||||
t, _ := template.ParseFiles("panel.gtpl")
|
||||
t.Execute(w, nil)
|
||||
} else {
|
||||
r.ParseForm()
|
||||
fmt.Println("username:", r.Form["username"])
|
||||
fmt.Println("password:", r.Form["password"])
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/", sayhelloName)
|
||||
http.HandleFunc("/login", login)
|
||||
http.HandleFunc("/panel", panel)
|
||||
err := http.ListenAndServe(":9197", nil)
|
||||
if err != nil {
|
||||
log.Fatal("ListenAndServe: ", err)
|
||||
|
Loading…
Reference in New Issue
Block a user