handler

package
v0.0.0-...-4185ac2 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2019 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShiftPath

func ShiftPath(p string) (head, tail string)

ShiftPath splits off the first component of p, which will be cleaned of relative components before processing. head will never contain a slash and tail will always be a rooted path without trailing slash.

Types

type FoodHandler

type FoodHandler struct {
	// contains filtered or unexported fields
}

FoodHandler handles initial HTTP request on /food/*

func (*FoodHandler) ServeHTTP

func (fHandler *FoodHandler) ServeHTTP(res http.ResponseWriter, req *http.Request)

ServeHTTP responds to http request or routes to appropriate handler

type Handler

type Handler struct {
	DB       *database.Database
	FHandler *FoodHandler
	UHandler *UserHandler
}

Handler handles initial HTTP request and forwards to appropriate handler.

func CreateHandler

func CreateHandler() *Handler

CreateHandler creates a new Handler, connects to database, and initializes the (sub)handlers

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(res http.ResponseWriter, req *http.Request)

ServeHTTP responds to http request or routes to appropriate handler

type UserHandler

type UserHandler struct {
	// contains filtered or unexported fields
}

UserHandler routes and processes requests for /user/* Path

func (*UserHandler) ServeHTTP

func (uHandler *UserHandler) ServeHTTP(res http.ResponseWriter, req *http.Request)

ServeHTTP is the first stop for the /user/ path request

type UserLogon

type UserLogon struct {
	User     string `json:"user"`
	Password string `json:"password"`
}

UserLogon is a struct used to unmarshal json request to login

Jump to

Keyboard shortcuts

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