controllers

package
v0.0.0-...-bde98bf Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2020 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Router        *chi.Mux
	RecipeStore   contracts.IRecipeStore
	UserStore     contracts.IUserStore
	CategoryStore contracts.ICategoryStore
	CommentStore  contracts.ICommentStore
	Validator     *validator.Validate
	Translator    ut.Translator
	APISecret     string
}

App is struct for application

func (*App) AddComment

func (a *App) AddComment(w http.ResponseWriter, r *http.Request)

AddComment POST /api/recipes/{recipeID}/comments

func (*App) Chat

func (a *App) Chat(w http.ResponseWriter, r *http.Request)

func (*App) CreateRecipe

func (a *App) CreateRecipe(w http.ResponseWriter, r *http.Request)

CreateRecipe POST /api/recipes

func (*App) DeleteRecipe

func (a *App) DeleteRecipe(w http.ResponseWriter, r *http.Request)

DeleteRecipe DELETE /api/recipes/{recipeID}

func (*App) GetRecipeByID

func (a *App) GetRecipeByID(w http.ResponseWriter, r *http.Request)

GetRecipeByID GET /recipe/{recipeID}

func (*App) GetRecipeComments

func (a *App) GetRecipeComments(w http.ResponseWriter, r *http.Request)

GetRecipeComments GET /api/recipes/{recipeID}/comments

func (*App) Init

func (a *App) Init()

Init initiates the app

func (*App) ListCategories

func (a *App) ListCategories(w http.ResponseWriter, r *http.Request)

ListCategories GET /api/categories

func (*App) ListRecipes

func (a *App) ListRecipes(w http.ResponseWriter, r *http.Request)

ListRecipes GET /api/recipes

func (*App) Login

func (a *App) Login(w http.ResponseWriter, r *http.Request)

Login receives username and password and logs in the user if the credentials are valid Returns a jwt token via json response

func (*App) Register

func (a *App) Register(w http.ResponseWriter, r *http.Request)

Register receives username, password, email, RepeatPassword If the credentials are valid Returns a jwt token via json response

func (*App) RegisterRoutes

func (a *App) RegisterRoutes()

RegisterRoutes registers routes of the app

func (*App) Run

func (a *App) Run(addr string)

Run starts the rest api server

func (*App) UpdateRecipe

func (a *App) UpdateRecipe(w http.ResponseWriter, r *http.Request)

UpdateRecipe PUT /api/recipes/{recipeID}

type ConnectionMap

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

func (*ConnectionMap) Delete

func (c *ConnectionMap) Delete(client *websocket.Conn)

func (*ConnectionMap) SendMsg

func (c *ConnectionMap) SendMsg(msg models.Message)

func (*ConnectionMap) Store

func (c *ConnectionMap) Store(client *websocket.Conn, connected bool)

Jump to

Keyboard shortcuts

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