api

package
v0.0.0-...-e6f8ebc Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DrainBody

func DrainBody(r *http.Request)

DrainBody drains the body of the given HTTP request

func ErrorResponse

func ErrorResponse(ctx context.Context, w http.ResponseWriter, status int, errorResponse *models.ErrorResponse)

ErrorResponse sets the structured error message in the http response body

Types

type FoodRecipeAPI

type FoodRecipeAPI struct {
	DefaultMaxResults int
	MongoClient       *mongo.Client
	Router            *mux.Router
}

FoodRecipeAPI manages access to food recipes

func NewFoodRecipeAPI

func NewFoodRecipeAPI(ctx context.Context, connectionString string, mongoClient *mongo.Client, data map[string]models.Recipe, defaultMaxResults int, router *mux.Router) *FoodRecipeAPI

NewFoodRecipeAPI create a new Food Recipe API instance and register the API routes based on the application configuration.

Jump to

Keyboard shortcuts

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