Lavoro su html

This commit is contained in:
Claudio Maggioni 2017-05-26 15:35:26 +02:00
parent fb5aa3ac6a
commit f85118aaba
3 changed files with 31 additions and 8 deletions

20
html.go Normal file
View File

@ -0,0 +1,20 @@
package main
import (
"html/template"
"net/http"
)
// ServiHTML fa partire il server html
func ServiHTML() {
http.HandleFunc("/", handlerRoot)
http.ListenAndServe(":3000", nil)
}
func handlerRoot(w http.ResponseWriter, r *http.Request) {
templ, err := template.ParseFiles("template/hello.html")
if err != nil {
panic(err.Error())
}
templ.Execute(w, new(interface{}))
}

View File

@ -51,6 +51,9 @@ func main() { //FUNZIONE MAIN
}
}
}
go ServiHTML() // fai partire il server html
fmt.Println("Situazione iniziale: ")
stampaMatrice()
@ -107,7 +110,6 @@ func muovi(h int, w int) { //FUNZIONE MUOVI: aggiorna la posizione di tutti gli
Matrix[h][w] = nil
}
}
func stampaMatrice() {

1
template/hello.html Normal file
View File

@ -0,0 +1 @@
hello