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 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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