knowyt/server/knyt.go
2021-07-31 09:55:43 +02:00

30 lines
612 B
Go

package main
import (
"fmt"
"net/http"
"sirlab.de/go/knyt/app"
"sirlab.de/go/knyt/engine"
"sirlab.de/go/knyt/handler"
)
func main() {
app := app.NewApp()
app.Mux = handler.NewAuthMux()
app.Eng = engine.NewEngine()
http.Handle("/", app.Mux)
app.Mux.PublicHandleFunc("/__intern__/exit", handler.Exit)
// default handler
fsHandler := http.FileServer(http.Dir("../client/dist/"))
app.Mux.PublicHandle("/", fsHandler)
app.Mux.PublicHandleFunc("/api/sync", app.Eng.GetHttpHandler())
go app.Eng.Run()
// start listening
fmt.Println("http://localhost:32039")
http.ListenAndServe(":32039", nil)
}