api

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAccept = errors.New("accept header must be application/json; charset=utf-8")

ErrAccept accept error

View Source
var ErrContentType = errors.New("Content-Type header must be application/json; charset=utf-8")

ErrContentType content type error

Functions

This section is empty.

Types

type RequestHandlerFunction

type RequestHandlerFunction func(db repositories.Executor, w http.ResponseWriter, r *http.Request)

RequestHandlerFunction is the function to call any handle

type Server

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

Server represents the whole service

func (*Server) Get

func (s *Server) Get(path string, f func(w http.ResponseWriter, r *http.Request))

Get wraps the router for GET method

func (*Server) Health

func (s *Server) Health(path string, f func(w http.ResponseWriter, r *http.Request))

Health provides the /health route for load balancer health check

func (*Server) Initialize

func (s *Server) Initialize()

Initialize does the app initialization

func (*Server) Post

func (s *Server) Post(path string, f func(w http.ResponseWriter, r *http.Request))

Post wraps the router for POST method

func (*Server) Run

func (s *Server) Run(addr string)

Run runs the server on specific port

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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