/api/userinfo (WIP)
This commit is contained in:
parent
2d2a9456c6
commit
06aaed8237
2
client/dist/index.html
vendored
2
client/dist/index.html
vendored
@ -7,7 +7,7 @@
|
||||
<body>
|
||||
<h1>KnYC</h1>
|
||||
<p>
|
||||
<a href="/private/">/private/</a>
|
||||
<a href="/api/userinfo">/api/userinfo</a>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -17,7 +17,3 @@ func CreateVersionHandler() HandlerFunc {
|
||||
fmt.Fprintf(w, "%d\n", startTime)
|
||||
}
|
||||
}
|
||||
|
||||
func IsLoggedIn(w http.ResponseWriter, _ *http.Request) {
|
||||
fmt.Fprintf(w, "ok")
|
||||
}
|
||||
|
12
server/src/handler/userinfo.go
Normal file
12
server/src/handler/userinfo.go
Normal 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))
|
||||
}
|
@ -19,10 +19,10 @@ func main() {
|
||||
mux := handler.NewAuthMux(app)
|
||||
|
||||
mux.PublicHandleFunc("/__intern__/exit", handler.Exit)
|
||||
mux.PrivateHandleFunc("/api/userinfo", handler.GetUserInfo)
|
||||
|
||||
// default handler
|
||||
fsHandler := http.FileServer(http.Dir("../../client/dist/"))
|
||||
mux.PrivateHandle("/private/", fsHandler)
|
||||
mux.PublicHandle("/", fsHandler)
|
||||
|
||||
// start listening
|
||||
|
Loading…
Reference in New Issue
Block a user