|
|
@ -13,7 +13,25 @@ type Data struct {
|
|
|
|
Password string
|
|
|
|
Password string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func handleRequest(w http.ResponseWriter, r *http.Request) {
|
|
|
|
type DataLogin struct {
|
|
|
|
|
|
|
|
Identifier string
|
|
|
|
|
|
|
|
Password string
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func handleRequestRoot(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
|
|
|
body, err := ioutil.ReadAll(r.Body)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
fmt.Printf("body read KO")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var data Data
|
|
|
|
|
|
|
|
err = json.Unmarshal(body, &data)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
fmt.Printf("deserialis KO")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Printf("%+v\n", data)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func handleRequestLogin(w http.ResponseWriter, r *http.Request) {
|
|
|
|
body, err := ioutil.ReadAll(r.Body)
|
|
|
|
body, err := ioutil.ReadAll(r.Body)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
fmt.Printf("body read KO")
|
|
|
|
fmt.Printf("body read KO")
|
|
|
@ -28,6 +46,11 @@ func handleRequest(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
func main() {
|
|
|
|
mainORM()
|
|
|
|
mainORM()
|
|
|
|
http.HandleFunc("/", handleRequest)
|
|
|
|
http.HandleFunc("/", handleRequestRoot)
|
|
|
|
|
|
|
|
http.HandleFunc("/login", handleRequestLogin)
|
|
|
|
|
|
|
|
//http.HandleFunc("/", handleRequestRoot)
|
|
|
|
|
|
|
|
//http.HandleFunc("/", handleRequestRoot)
|
|
|
|
|
|
|
|
//http.HandleFunc("/", handleRequestRoot)
|
|
|
|
|
|
|
|
//http.HandleFunc("/", handleRequestRoot)
|
|
|
|
log.Fatal(http.ListenAndServe(":8088", nil))
|
|
|
|
log.Fatal(http.ListenAndServe(":8088", nil))
|
|
|
|
}
|
|
|
|
}
|
|
|
|