Exemplo n.º 1
0
func main() {

	r := lessgo.ConfigLessgo()

	portString, _ := lessgo.Config.GetValue("lessgo", "port")

	port, _ := strconv.Atoi(portString)

	for url, handler := range handlers {
		r.HandleFunc(url, handler)
	}

	//	go server.ReportSend()

	http.Handle("/", r)

	http.Handle("/js/", http.FileServer(http.Dir("../static")))
	http.Handle("/img/", http.FileServer(http.Dir("../static")))
	http.Handle("/css/", http.FileServer(http.Dir("../static")))
	http.Handle("/json/", http.FileServer(http.Dir("../static")))
	http.Handle("/newsimg/", http.FileServer(http.Dir("../")))
	http.Handle("/artimg/", http.FileServer(http.Dir("../")))

	fmt.Println("服务器监听", portString, "端口")
	//	go server.UpdateVideoStatus()

	//	tool.SendMsg()

	lessgo.Log.Error(http.ListenAndServe(fmt.Sprintf(":%d", port), nil))

}
Exemplo n.º 2
0
func main() {

	r := lessgo.ConfigLessgo()

	portString, _ := lessgo.Config.GetValue("lessgo", "port")

	port, _ := strconv.Atoi(portString)

	http.Handle("/json/", http.FileServer(http.Dir("../static")))

	http.Handle("/", r)

	fmt.Println("服务器监听", portString, "端口")

	lessgo.Log.Error(http.ListenAndServe(fmt.Sprintf(":%d", port), nil))

}