Documentation
¶
Index ¶
- func Close(ctx context.Context) error
- func CreateAndInitialiseRecipeAPI(ctx context.Context, cfg config.Configuration, dataStore store.DataStore, ...)
- type RecipeAPI
- func (api *RecipeAPI) AddAllRecipeHandler(w http.ResponseWriter, req *http.Request)
- func (api *RecipeAPI) HealthCheck(w http.ResponseWriter, req *http.Request)
- func (api *RecipeAPI) RecipeHandler(w http.ResponseWriter, req *http.Request)
- func (api *RecipeAPI) RecipeListHandler(w http.ResponseWriter, req *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateAndInitialiseRecipeAPI ¶
func CreateAndInitialiseRecipeAPI(ctx context.Context, cfg config.Configuration, dataStore store.DataStore, hc *healthcheck.HealthCheck, errorChan chan error)
CreateAndInitialiseRecipeAPI create a new RecipeAPI instance based on the configuration provided and starts the HTTP server.
Types ¶
type RecipeAPI ¶
type RecipeAPI struct { Router *mux.Router EnableMongoData bool EnableMongoImport bool // contains filtered or unexported fields }
RecipeAPI contains store and features for managing the recipe
func NewRecipeAPI ¶
func NewRecipeAPI(ctx context.Context, cfg config.Configuration, router *mux.Router, dataStore store.DataStore) *RecipeAPI
NewRecipeAPI create a new Recipe API instance and register the API routes based on the application configuration.
func (*RecipeAPI) AddAllRecipeHandler ¶
func (api *RecipeAPI) AddAllRecipeHandler(w http.ResponseWriter, req *http.Request)
AddAllRecipeHandler - Adds all the recipes from data.go to the mongo database
func (*RecipeAPI) HealthCheck ¶
func (api *RecipeAPI) HealthCheck(w http.ResponseWriter, req *http.Request)
HealthCheck - health check endpoint
func (*RecipeAPI) RecipeHandler ¶
func (api *RecipeAPI) RecipeHandler(w http.ResponseWriter, req *http.Request)
RecipeHandler - get recipe by ID
func (*RecipeAPI) RecipeListHandler ¶
func (api *RecipeAPI) RecipeListHandler(w http.ResponseWriter, req *http.Request)
RecipeListHandler - get all recipes
Click to show internal directories.
Click to hide internal directories.