handler

package
v0.0.0-...-45bb23c Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// UserCtxKey is user's id context key.
	UserCtxKey = "userID"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Registration

type Registration struct {
	models.User
}

Registration struct holds information about user.

func (*Registration) ValidateSignUp

func (r *Registration) ValidateSignUp(req *http.Request) error

ValidateSignUp validates signUp handler.

type RequestID

type RequestID struct {
	ID string `json:"id"`
}

RequestID is for id output in JSON.

type Server

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

Server are complex of routers and services.

func NewServer

func NewServer(src service.Interface) *Server

NewServer configures server.

func (*Server) GetIDFromContext

func (s *Server) GetIDFromContext(ctx context.Context) (int, error)

GetIDFromContext get user's id from context.

func (*Server) Run

func (s *Server) Run(port string, handler http.Handler) error

Run runs the server.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown stops the server.

type UserIDCtx

type UserIDCtx string

UserIDCtx is custom type.

Jump to

Keyboard shortcuts

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