You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Go/httpListener.go

34 lines
527 B

package main
import (
"encoding/json"
"fmt"
"net/http"
"log"
"io/ioutil"
)
type Data struct {
Identifier string
Password string
}
func handleRequest(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 main() {
mainORM()
http.HandleFunc("/", handleRequest)
log.Fatal(http.ListenAndServe(":8088", nil))
}