finding a bug

This commit is contained in:
Daniel Ledda
2020-11-01 00:46:59 +01:00
parent 94dac8a699
commit 38e2211df7

View File

@@ -4,6 +4,7 @@ import (
"database/sql" "database/sql"
_ "github.com/go-sql-driver/mysql" _ "github.com/go-sql-driver/mysql"
"fmt" "fmt"
"io/ioutil"
"log" "log"
"net/http" "net/http"
//"net/url" //"net/url"
@@ -37,8 +38,12 @@ func main() {
} }
func viewHandler(w http.ResponseWriter, r *http.Request) { func viewHandler(w http.ResponseWriter, r *http.Request) {
fmt.Println(r.Body)
fmt.Println("Request received") fmt.Println("Request received")
reqBody, err := ioutil.ReadAll(r.Body)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", reqBody)
_, _ = fmt.Fprint(w, "<h1>Climate Stuff</h1><div>The data will show up here at some stage...</div>") _, _ = fmt.Fprint(w, "<h1>Climate Stuff</h1><div>The data will show up here at some stage...</div>")
} }