/api/userinfo (WIP)

This commit is contained in:
Settel 2021-08-02 09:52:47 +02:00
parent 2d2a9456c6
commit 06aaed8237
4 changed files with 14 additions and 6 deletions

View File

@ -7,7 +7,7 @@
<body> <body>
<h1>KnYC</h1> <h1>KnYC</h1>
<p> <p>
<a href="/private/">/private/</a> <a href="/api/userinfo">/api/userinfo</a>
</p> </p>
</body> </body>
</html> </html>

View File

@ -17,7 +17,3 @@ func CreateVersionHandler() HandlerFunc {
fmt.Fprintf(w, "%d\n", startTime) fmt.Fprintf(w, "%d\n", startTime)
} }
} }
func IsLoggedIn(w http.ResponseWriter, _ *http.Request) {
fmt.Fprintf(w, "ok")
}

View File

@ -0,0 +1,12 @@
package handler
import (
"fmt"
"net/http"
)
func GetUserInfo(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Content-Type", "application/json")
jsonString := "{}"
fmt.Fprintf(w, string(jsonString))
}

View File

@ -19,10 +19,10 @@ func main() {
mux := handler.NewAuthMux(app) mux := handler.NewAuthMux(app)
mux.PublicHandleFunc("/__intern__/exit", handler.Exit) mux.PublicHandleFunc("/__intern__/exit", handler.Exit)
mux.PrivateHandleFunc("/api/userinfo", handler.GetUserInfo)
// default handler // default handler
fsHandler := http.FileServer(http.Dir("../../client/dist/")) fsHandler := http.FileServer(http.Dir("../../client/dist/"))
mux.PrivateHandle("/private/", fsHandler)
mux.PublicHandle("/", fsHandler) mux.PublicHandle("/", fsHandler)
// start listening // start listening