parent
7af66e799d
commit
5eb5f1b1c3
@ -0,0 +1,19 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func main(){
|
||||
log.Println("listen on 8080...")
|
||||
http.HandleFunc("/",index)
|
||||
//监听端口
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
||||
//输出首页
|
||||
func index(w http.ResponseWriter, r *http.Request){
|
||||
t,_:=template.ParseFiles("./tmpl/index.html")
|
||||
t.Execute(w, nil)
|
||||
}
|
@ -0,0 +1 @@
|
||||
<h1>hello</h1>
|
Loading…
Reference in new issue