http

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host string
	Port uint16

	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	DialTimeout  time.Duration

	TemplatesBasePath string
	EnableAccessLog   bool
}

Config holds all the configuration required to start the HTTP server

type HTTP

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

func NewService

func NewService(cfg *Config, apis api.Server) (*HTTP, error)

NewService returns an instance of HTTP with all its dependencies set

func (*HTTP) Shutdown

func (h *HTTP) Shutdown(ctx context.Context) error

func (*HTTP) Start

func (h *HTTP) Start() error

Start starts the HTTP server

type Handlers

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

Handlers struct has all the dependencies required for HTTP handlers

func (*Handlers) CreateUser

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

CreateUser is the HTTP handler to create a new user This handler does not use any framework, instead just the standard library

func (*Handlers) CreateUserNote

func (h *Handlers) CreateUserNote(w http.ResponseWriter, r *http.Request) error

func (*Handlers) Health

func (h *Handlers) Health(w http.ResponseWriter, r *http.Request) error

Health is the HTTP handler to return the status of the app including the version, and other details This handler uses webgo to respond to the http request

func (*Handlers) HelloWorld

func (h *Handlers) HelloWorld(w http.ResponseWriter, r *http.Request) error

HelloWorld is a helloworld HTTP handler

func (*Handlers) ReadUserByEmail

func (h *Handlers) ReadUserByEmail(w http.ResponseWriter, r *http.Request) error

ReadUserByEmail is the HTTP handler to read an existing user by email

Jump to

Keyboard shortcuts

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