knowyt/server/knyt.go
2021-07-30 20:18:04 +02:00

28 lines
536 B
Go

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