server

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CurrenciesResponse

type CurrenciesResponse struct {
	Results []types.Currency `json:"results"`
}

type ErrorResponse

type ErrorResponse struct {
	Error error `json:"error"`
}

type Option

type Option func(s *Server)

func WithConfig

func WithConfig(c *config.Config) Option

WithConfig specifies the config for the server

func WithLogger

func WithLogger(l *slog.Logger) Option

WithLogger specifies the logger for the server

type RoutesFn

type RoutesFn func(router chi.Router)

RoutesFn is a callback that receives a router for registering routes

type Server

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

func New

func New(storage storage.Storage, opts ...Option) (*Server, error)

New creates a new server instance

func (*Server) Currencies

func (s *Server) Currencies(w http.ResponseWriter, r *http.Request)

func (*Server) OpenAPI

func (s *Server) OpenAPI(w http.ResponseWriter, _ *http.Request)

func (*Server) RatesForBase

func (s *Server) RatesForBase(w http.ResponseWriter, r *http.Request)

func (*Server) RatesForPair

func (s *Server) RatesForPair(w http.ResponseWriter, r *http.Request)

func (*Server) Redoc

func (s *Server) Redoc(w http.ResponseWriter, _ *http.Request)

func (*Server) Routes

func (s *Server) Routes(fn RoutesFn)

Routes calls fn with the server mux so callers can add endpoints

func (*Server) Serve

func (s *Server) Serve(ctx context.Context) error

Serve serves the fxrates service

func (*Server) Sources

func (s *Server) Sources(w http.ResponseWriter, r *http.Request)

type SourcesResponse

type SourcesResponse struct {
	Results []types.Source `json:"results"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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