2021-07-28 20:21:14 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"net/http"
|
2021-07-30 14:16:55 +00:00
|
|
|
"sirlab.de/go/knyt/engine"
|
|
|
|
"sirlab.de/go/knyt/handler"
|
2021-07-28 20:21:14 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
app := handler.NewAuthMux()
|
|
|
|
http.Handle("/", app)
|
|
|
|
|
|
|
|
app.PublicHandleFunc("/__intern__/exit", handler.Exit)
|
|
|
|
|
|
|
|
// default handler
|
2021-07-29 19:06:25 +00:00
|
|
|
fsHandler := http.FileServer(http.Dir("../client/dist/"))
|
2021-07-28 20:21:14 +00:00
|
|
|
app.PublicHandle("/", fsHandler)
|
|
|
|
|
2021-07-29 19:06:25 +00:00
|
|
|
eng := engine.NewEngine()
|
|
|
|
app.PublicHandleFunc("/sync", eng.GetHttpHandler())
|
|
|
|
go eng.Run()
|
2021-07-28 21:17:08 +00:00
|
|
|
|
2021-07-28 20:21:14 +00:00
|
|
|
// start listening
|
|
|
|
fmt.Println("http://localhost:32039")
|
|
|
|
http.ListenAndServe(":32039", nil)
|
|
|
|
}
|