Documentation
¶
Overview ¶
Package uniratefiber exposes the UniRate API as a set of Fiber HTTP handlers.
Register wires four routes onto a *fiber.App (or any fiber.Router such as a group), each backed by a *unirate.Client:
/rate?from=USD&to=EUR /convert?from=USD&to=EUR&amount=100 /currencies /vat?country=DE (country optional; omit for all countries)
UniRate client errors are mapped to appropriate HTTP status codes and a JSON error body of the form {"error": "...", "status": <code>}.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( WithTimeout = unirate.WithTimeout WithHTTPClient = unirate.WithHTTPClient WithBaseURL = unirate.WithBaseURL )
WithTimeout, WithHTTPClient and WithBaseURL are re-exported client options.
Functions ¶
func ConvertHandler ¶
ConvertHandler returns the /convert handler.
func CurrenciesHandler ¶
CurrenciesHandler returns the /currencies handler.
func RateHandler ¶
RateHandler returns the /rate handler.
func Register ¶
Register attaches the UniRate routes to r using client. r may be a *fiber.App or any fiber.Router (e.g. an app.Group).
func VATHandler ¶
VATHandler returns the /vat handler.