21 lines
363 B
Go
21 lines
363 B
Go
package main
|
|
|
|
import (
|
|
"html/template"
|
|
"net/http"
|
|
)
|
|
|
|
func main() {
|
|
tpl, err := template.ParseFiles("tpl.html")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
http.HandleFunc("/hello/", func(res http.ResponseWriter, req *http.Request) {
|
|
err = tpl.ExecuteTemplate(res, "tpl.html", "Hello World")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
})
|
|
http.ListenAndServe(":9000", nil)
|
|
}
|