http

package
v0.0.0-...-4269795 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	Router  chi.Router
	Service UserService
	Server  *http.Server
}

Handler - stores pointer to our user service

func NewHandler

func NewHandler(service UserService) *Handler

NewHandler - returns a pointer to a Handler

func (*Handler) AliveCheck

func (h *Handler) AliveCheck(w http.ResponseWriter, r *http.Request)

func (*Handler) CreateUser

func (h *Handler) CreateUser(w http.ResponseWriter, r *http.Request)

func (*Handler) DeleteUser

func (h *Handler) DeleteUser(w http.ResponseWriter, r *http.Request)

TODO - needs to be fixed

func (*Handler) GetUser

func (h *Handler) GetUser(w http.ResponseWriter, r *http.Request)

func (*Handler) Serve

func (h *Handler) Serve() error

Serve - gracefully serves our newly set up handler function

func (*Handler) UpdateUser

func (h *Handler) UpdateUser(w http.ResponseWriter, r *http.Request)

type Response

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

Response object

type UserService

type UserService interface {
	GetUser(ctx context.Context, email string) (users.User, error)
	CreateUser(ctx context.Context, in users.User) (users.User, error)
	UpdateUser(ctx context.Context, in users.User) (users.User, error)
	DeleteUser(ctx context.Context, email string) error
}

Jump to

Keyboard shortcuts

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