handlers

package
v0.0.0-...-cc2b1d6 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckHealthHandler

func CheckHealthHandler(w http.ResponseWriter, r *http.Request)

Types

type ArticleHandler

type ArticleHandler struct {
	Service         *services.ArticleService
	CategoryService *services.CategoryService
}

func NewArticleHandler

func NewArticleHandler(service *services.ArticleService, categoryService *services.CategoryService) *ArticleHandler

func (*ArticleHandler) CreateArticle

func (h *ArticleHandler) CreateArticle(w http.ResponseWriter, r *http.Request)

CreateArticle action will parse form values, validate it and pass to the article service.

func (*ArticleHandler) DeleteArticle

func (h *ArticleHandler) DeleteArticle(w http.ResponseWriter, r *http.Request)

DeleteArticle will get article and delete it. Will redirect to homepage If successfully.

func (*ArticleHandler) EditArticle

func (h *ArticleHandler) EditArticle(w http.ResponseWriter, r *http.Request)

EditArticle will render edit article form.

func (*ArticleHandler) GetAllArticles

func (h *ArticleHandler) GetAllArticles(w http.ResponseWriter, r *http.Request)

GetAllArticles will fetch all articles in database and render to the template.

func (*ArticleHandler) GetArticle

func (h *ArticleHandler) GetArticle(w http.ResponseWriter, r *http.Request)

GetArticle get article information and render to the template.

func (*ArticleHandler) NewArticle

func (h *ArticleHandler) NewArticle(w http.ResponseWriter, r *http.Request)

NewArticle will render create article form with categories data for multiple select.

func (*ArticleHandler) UpdateArticle

func (h *ArticleHandler) UpdateArticle(w http.ResponseWriter, r *http.Request)

UpdateArticle is a function for updating an article.

type CategoryHandlers

type CategoryHandlers struct {
	Service *services.CategoryService
}

func NewCategoryHandlers

func NewCategoryHandlers(service *services.CategoryService) *CategoryHandlers

func (*CategoryHandlers) CreateCategory

func (h *CategoryHandlers) CreateCategory(w http.ResponseWriter, r *http.Request)

CreateCategory handler that create new category.

func (*CategoryHandlers) DeleteCategory

func (h *CategoryHandlers) DeleteCategory(w http.ResponseWriter, r *http.Request)

DeleteCategory handler that delete a category.

func (*CategoryHandlers) EditCategory

func (h *CategoryHandlers) EditCategory(w http.ResponseWriter, r *http.Request)

EditCategory will parse and render edit category form with its value.

func (*CategoryHandlers) NewCategory

func (h *CategoryHandlers) NewCategory(w http.ResponseWriter, r *http.Request)

NewCategory will parse and render create category form.

func (*CategoryHandlers) UpdateCategory

func (h *CategoryHandlers) UpdateCategory(w http.ResponseWriter, r *http.Request)

UpdateCategory handler that update a category.

type ImageHandler

type ImageHandler struct {
}

func NewImageHandler

func NewImageHandler() *ImageHandler

func (*ImageHandler) ServeImages

func (h *ImageHandler) ServeImages(w http.ResponseWriter, r *http.Request)

ServeImages serve image directory as static files.

func (*ImageHandler) UploadHandler

func (h *ImageHandler) UploadHandler(w http.ResponseWriter, r *http.Request)

UploadHandler creates a new file in the images directory and copies the incoming file to this new file.

Jump to

Keyboard shortcuts

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