package main import ( "fmt" "net/http" "os" "sirlab.de/go/knyt/application" "sirlab.de/go/knyt/applicationConfig" "sirlab.de/go/knyt/handler" ) func main() { appConfig := applicationConfig.NewApplicationConfig() app, err := application.NewApplication(appConfig) if err != nil { fmt.Printf("%v\n", err) os.Exit(1) } mux := handler.NewAuthMux(app) mux.PublicHandleFunc("/__intern__/exit", handler.Exit) mux.PublicHandleFunc("/api/login", mux.Login) mux.PublicHandleFunc("/api/logout", mux.Logout) mux.PrivateHandleFunc("/api/userinfo", mux.GetUserInfo) mux.PrivateHandleFunc("/api/gameinfo", app.GetGameInfo) mux.PrivateHandleFunc("/api/sync", app.SyncHandler) mux.PrivateHandleFunc("/api/collectQuotes", app.CollectQuotes) mux.PrivateHandleFunc("/api/startGame", app.StartGame) mux.PrivateHandleFunc("/api/resetGame", app.ResetGame) mux.PrivateHandleFunc("/api/continueGame", app.ContinueGame) mux.PrivateHandleFunc("/api/finishGame", app.FinishGame) mux.PrivateHandleFunc("/api/saveSelection", app.SaveSelection) mux.PrivateHandleFunc("/api/getQuotes", app.GetQuotes) mux.PrivateHandleFunc("/api/saveQuote", app.SaveQuote) mux.PrivateHandleFunc("/api/removeQuote", app.RemoveQuote) // default handler fsHandler := http.FileServer(http.Dir("../../client/dist/")) mux.PublicHandle("/", fsHandler) // start listening fmt.Printf("http://localhost:%d/\n", mux.Port) mux.ListenAndServe() }