http

package
v0.0.0-...-d05f80c Latest Latest
Warning

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

Go to latest
Published: May 22, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package http contains the HTTP server and associated endpoint handlers.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBodyDecode = httperr.New(http.StatusBadRequest, "failed to decode body")
)

Functions

This section is empty.

Types

type Resp

type Resp struct {
	Error string      `json:"error,omitempty"`
	Data  interface{} `json:"data,omitempty"`
}

type Server

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

func NewServer

func NewServer(logger *zap.SugaredLogger, httpPort int, svc Service) *Server

func (*Server) GetV1ApiRouters

func (s *Server) GetV1ApiRouters() func(chi.Router)

func (*Server) Run

func (s *Server) Run() error

func (*Server) Shutdown

func (s *Server) Shutdown()

type Service

type Service interface {
	CreateWallet(dto.CreateWalletRequest) error
	IncreaseWalletBalance(dto.Deposit) error
	Transfer(dto.Transfer) error
	GetOperations(dto.OperationsFilter) ([]dto.Operation, error)
}

Service describes the service methods required for the server.

Jump to

Keyboard shortcuts

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