public

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	Uploads(ctx *gin.Context)
	Assets(ctx *gin.Context)
	Serve(ctx *gin.Context)
	Screenshot(ctx *gin.Context)
}

Handler defines methods for the frontend to interact with the server.

type Public

type Public struct {
	*deps.Deps
	// contains filtered or unexported fields
}

Public defines the handler for all public routes.

func New

func New(d *deps.Deps) *Public

New

Creates a new public handler.

func (*Public) Assets

func (p *Public) Assets(ctx *gin.Context)

Assets

Returns assets from the theme path and returns webp file if the browser accepts it.

Returns a http.StatusNotFound if the asset was not found.

func (*Public) Screenshot

func (p *Public) Screenshot(ctx *gin.Context)

Screenshot

Retrieves the screenshot of the theme passed.

Returns http.StatusInternalServerError if there was an error getting the layouts. Returns http.StatusOK if the themes were obtained successfully or there were none found.

func (*Public) Serve

func (p *Public) Serve(ctx *gin.Context)

Serve

Serves the front end website by obtaining the post from the store. If the error code is anything but errors.NOTFOUND, a http.StatusInternalServerError response will be sent.

Returns a http.StatusNotFound if the post was not found. Returns a http.StatusInternalServerError if the template file failed to execute.

func (*Public) Uploads

func (p *Public) Uploads(ctx *gin.Context)

Uploads

Returns assets from the uploads dir and returns webp file if the browser accepts it.

Returns a http.StatusNotFound if the upload was not found.

Jump to

Keyboard shortcuts

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