main.go
package main
import (
"net/http"
"text/template"
)
// 处理器函数
func ServerHttp(w http.ResponseWriter,r *http.Request){
t := template.Must(template.ParseFiles("view/index.html"))
t.Execute(w,nil)
}
func main(){
http.Handle("/css/",http.StripPrefix("/css/",http.FileServer(http.Dir("view/css"))))
http.Handle("/js/",http.StripPrefix("/js/",http.FileServer(http.Dir("view/js"))))
http.Handle("/images/",http.StripPrefix("/images/",http.FileServer(http.Dir("view/images"))))
http.Handle("/fonts/",http.StripPrefix("/fonts/",http.FileServer(http.Dir("view/fonts"))))
http.HandleFunc("/",ServerHttp)
http.ListenAndServe(":8080",nil)
}
db.go
package utils
import (
"fmt"
"database/sql"
_"mysql-master"
)
var