Documentation ¶
Overview ¶
Package handlers provides handler functions for web routes
Package handlers provides handler functions for web routes
Index ¶
- func AccountInfo(w http.ResponseWriter, r *http.Request)
- func ApiSelection(w http.ResponseWriter, r *http.Request)
- func GenerateHandlerMiddlewareFunc(udb rdb.Database, wdb rdb.Database) func(http.Handler) http.Handler
- func GetUdbFromCtx(r *http.Request) (rdb.Database, error)
- func GetValidationFromCtx(r *http.Request) (auth.ValidationPair, error)
- func Homepage(w http.ResponseWriter, r *http.Request)
- func LocationsOverview(w http.ResponseWriter, r *http.Request)
- func SaveUserToDB(udb rdb.Database, token string, userData schema.User) error
- func UsernameClaim(w http.ResponseWriter, r *http.Request)
- func UsernameInfo(w http.ResponseWriter, r *http.Request)
- func UsersSummary(w http.ResponseWriter, r *http.Request)
- func V0Status(w http.ResponseWriter, r *http.Request)
- type HandlerResponseKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccountInfo ¶
func AccountInfo(w http.ResponseWriter, r *http.Request)
Handler function for the secure route: /api/v0/my/account
func ApiSelection ¶
func ApiSelection(w http.ResponseWriter, r *http.Request)
Handler function for the route: /api
func GenerateHandlerMiddlewareFunc ¶
func GenerateHandlerMiddlewareFunc(udb rdb.Database, wdb rdb.Database) func(http.Handler) http.Handler
Generates middleware func to pass databases to handlers using context
func GetUdbFromCtx ¶
Attempt to get udb from context, return udb, nil if successful else return rdb.Database{}, nil
func GetValidationFromCtx ¶
func GetValidationFromCtx(r *http.Request) (auth.ValidationPair, error)
Attempt to get validation context
func Homepage ¶
func Homepage(w http.ResponseWriter, r *http.Request)
Handler function for the route: /
func LocationsOverview ¶
func LocationsOverview(w http.ResponseWriter, r *http.Request)
Handler function for the route: /api/v0/locations
func SaveUserToDB ¶
Attemmpt to save user, returns error or nil if successful
func UsernameClaim ¶
func UsernameClaim(w http.ResponseWriter, r *http.Request)
Handler function for the route: /api/v0/users/{username}/claim
func UsernameInfo ¶
func UsernameInfo(w http.ResponseWriter, r *http.Request)
Handler function for the route: /api/v0/users/{username}
func UsersSummary ¶
func UsersSummary(w http.ResponseWriter, r *http.Request)
Handler function for the route: /api/v0/users
Types ¶
type HandlerResponseKey ¶
type HandlerResponseKey int
ENUM for handler context
const ( UserDBContext HandlerResponseKey = iota WorldDBContext )