2021-07-28 20:21:14 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"net/http"
|
2021-08-01 17:06:33 +00:00
|
|
|
"sirlab.de/go/knyt/application"
|
2021-08-01 18:05:00 +00:00
|
|
|
"sirlab.de/go/knyt/applicationConfig"
|
2021-07-30 14:16:55 +00:00
|
|
|
"sirlab.de/go/knyt/handler"
|
2021-07-28 20:21:14 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2021-08-01 18:05:00 +00:00
|
|
|
appConfig := applicationConfig.NewApplicationConfig()
|
2021-08-01 17:06:33 +00:00
|
|
|
app := application.NewApplication(appConfig)
|
|
|
|
mux := handler.NewAuthMux(app)
|
2021-08-01 13:56:53 +00:00
|
|
|
|
2021-08-01 17:06:33 +00:00
|
|
|
mux.PublicHandleFunc("/__intern__/exit", handler.Exit)
|
2021-07-28 20:21:14 +00:00
|
|
|
|
|
|
|
// default handler
|
2021-08-01 16:36:02 +00:00
|
|
|
fsHandler := http.FileServer(http.Dir("../../client/dist/"))
|
2021-08-01 17:06:33 +00:00
|
|
|
mux.PrivateHandle("/private/", fsHandler)
|
|
|
|
mux.PublicHandle("/", fsHandler)
|
2021-07-28 20:21:14 +00:00
|
|
|
|
|
|
|
// start listening
|
2021-08-01 17:06:33 +00:00
|
|
|
fmt.Printf("http://localhost:%d/\n", mux.Port)
|
|
|
|
mux.ListenAndServe()
|
2021-07-28 20:21:14 +00:00
|
|
|
}
|