39 lines
667 B
Go
39 lines
667 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"log"
|
|
"net/http"
|
|
|
|
sauna "git.blackfinn.de/apiservice/sauna"
|
|
)
|
|
|
|
var (
|
|
logger log.Logger = *log.Default()
|
|
)
|
|
|
|
func init() {
|
|
logger.SetPrefix("Homeservice: ")
|
|
}
|
|
|
|
func main() {
|
|
logger.Println("starting")
|
|
|
|
var webui_path string
|
|
flag.StringVar(&webui_path, "d", "./build/webui", "Specify path to serve the web ui. Default is ./static")
|
|
flag.Parse()
|
|
|
|
// Start apis
|
|
sauna.Start()
|
|
|
|
// Serve files from static folder
|
|
http.Handle("/", http.FileServer(http.Dir(webui_path)))
|
|
|
|
port := ":5000"
|
|
logger.Println("Server is running on port" + port)
|
|
|
|
// Start server on port specified above
|
|
logger.Fatal(http.ListenAndServe(port, nil))
|
|
|
|
}
|