fix missing link calls
This commit is contained in:
10
main.go
10
main.go
@@ -2,8 +2,8 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"log"
|
||||
"mime"
|
||||
"net/http"
|
||||
"sync"
|
||||
|
||||
@@ -73,6 +73,10 @@ func http_endpoint_sauna(w http.ResponseWriter, r *http.Request) {
|
||||
func main() {
|
||||
logger.Println("starting")
|
||||
|
||||
var webui_path string
|
||||
flag.StringVar(&webui_path, "d", "./static", "Specify path to serve the web ui. Default is ./static")
|
||||
flag.Parse()
|
||||
|
||||
// MQTT connection
|
||||
opts := mqtt.NewClientOptions()
|
||||
opts.AddBroker("tcp://nuc:1883")
|
||||
@@ -91,11 +95,9 @@ func main() {
|
||||
token.Wait()
|
||||
logger.Printf("Subscribed to topic %s", topic)
|
||||
|
||||
mime.AddExtensionType(".js", "text/javascript; charset=utf-8")
|
||||
mime.AddExtensionType(".css", "text/css; charset=utf-8")
|
||||
// API routes
|
||||
// Serve files from static folder
|
||||
http.Handle("/", http.FileServer(http.Dir("/var/lib/home/")))
|
||||
http.Handle("/", http.FileServer(http.Dir(webui_path)))
|
||||
|
||||
http.HandleFunc("/sauna/sample", http_endpoint_sauna)
|
||||
|
||||
|
Reference in New Issue
Block a user