controllers

package
v0.0.0-...-f03aceb Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: MPL-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsServerReachable

func IsServerReachable(serverURL string) error

Check Server is reachable Does not validate the status code

Types

type App

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

func NewApp

func NewApp(config *config.Config, appLogger *logger.Logger, options ...ServerOption) *App

NewApp returns a new instance of the app with provided options applied.

func (*App) Flash

func (app *App) Flash(_ http.ResponseWriter, r *http.Request, t string, m string, c bool)

Flash handles the rendering flash messages

func (*App) FlashAndGoBack

func (app *App) FlashAndGoBack(w http.ResponseWriter, r *http.Request, t string, message string)

func (*App) HandleHomePage

func (c *App) HandleHomePage(w http.ResponseWriter, r *http.Request)

func (*App) JSONResponse

func (app *App) JSONResponse(w http.ResponseWriter, data any, c int)

func (*App) SendJSONError

func (app *App) SendJSONError(w http.ResponseWriter, message string, statusCodeOption ...int)

SendJSONError displays JSON error messages and exits the program.

func (*App) SendJSONSuccess

func (app *App) SendJSONSuccess(w http.ResponseWriter, message string, statusCodeOption ...int)

SendJSONSuccess displays JSON success messages and exits the program.

func (*App) SetupDB

func (app *App) SetupDB()

func (*App) SetupRoutes

func (app *App) SetupRoutes()

func (*App) Shutdown

func (app *App) Shutdown() error

Shutdown attempts to gracefully shutdown the server.

func (*App) StartServer

func (app *App) StartServer()

Start launches the server, listening on the configured address.

type ServerOption

type ServerOption func(*App)

ServerOption is a functional option that is used to configure the

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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