handlers

package
v0.0.0-...-4415030 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckUserHandler

func CheckUserHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

CheckUserHandler process the POST request from /user/check, checks whether a user and its authentication are right.

func CreatUserHandler

func CreatUserHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

CreatUserHandler processes the POST request from /user/create, creates a new user if the user doesn't exist.

func DeleteUserHandler

func DeleteUserHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

DeleteUserHandler processes the DELETC request from /user/delete, deletes the user by its uid or username if the user exists.

func GetPuzzleHandler

func GetPuzzleHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

GetPuzzleHandler processes the GET request from /puzzle/get, gets a puzzle by its pid

func GetUserHandler

func GetUserHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

GetUserHandler processes the GET request from /user/get, gets a user by its uid or username.

func HomeHandler

func HomeHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

HomeHandler processes the request from /

func SendResponse

func SendResponse(w http.ResponseWriter, data interface{}, err error) error

SendResponse sends the result and some other info to requester.

func SubmitPuzzleHandler

func SubmitPuzzleHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

SubmitPuzzleHandler processes the POST request from /puzzle/submit, submit a puzzle by its pid for an uid

Types

type Response

type Response struct {
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

Response is the data struct used to response a request.

Jump to

Keyboard shortcuts

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