handlers

package
v0.0.0-...-dd894d6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package handlers provides handler functions for web routes

Package handlers provides handler functions for web routes

Index

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

func GetUdbFromCtx(r *http.Request) (rdb.Database, error)

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

func SaveUserToDB(udb rdb.Database, token string, userData schema.User) error

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

func V0Status

func V0Status(w http.ResponseWriter, r *http.Request)

Handler function for the route: /api/v0

Types

type HandlerResponseKey

type HandlerResponseKey int

ENUM for handler context

const (
	UserDBContext HandlerResponseKey = iota
	WorldDBContext
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL