コード例 #1
0
func rootHandler(writer http.ResponseWriter, request *http.Request) {
	var pageData data.PageWrapper
	ip, err := getMqttHost()
	if check(err, 500, &writer) {
		return
	}
	pageData.ServerIP = ip
	pageData.MqttPort = manifest.Server.MqttPort
	serveTemplate(writer, request, path.Join(manifest.Server.WebRoot, "dynamic", "index.html"), pageData)
}
コード例 #2
0
func defaultHandler(writer http.ResponseWriter, request *http.Request) {
	var pageData data.PageWrapper
	ip, err := getMqttHost()
	if check(err, 500, &writer) {
		return
	}
	pageData.ServerIP = ip
	pageData.MqttPort = manifest.Server.MqttPort
	config.DebugLog("Request for: "+request.Method+" \"", request.URL.Path, "\"")
	vars := mux.Vars(request)
	fileType := vars["fileType"]
	serveTemplate(writer, request, path.Join(manifest.Server.WebRoot, "dynamic", fileType+".html"), pageData)
}