app

package
v0.31.10 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package app contains your local application object. It uses an object oriented model to implement a default application, and provides hooks for you to customize its behavior. Web applications can grow in complicated ways, and this is the main place you will customize how the server itself behaves.

Index

Constants

View Source
const LocalContextKey = goradd.ContextKey("app.local")

Variables

This section is empty.

Functions

func PutLocalContext added in v0.12.0

func PutLocalContext(ctx context.Context) context.Context

PutLocalContext allocates our application specific context object and returns it so we can get to it later as the context gets passed around the application.

Types

type Application

type Application struct {
	app.Application
}

func MakeApplication

func MakeApplication() *Application

MakeApplication creates the application object and related objects.

You can potentially read command line params and make other versions of the app for testing purposes.

func (*Application) Init

func (a *Application) Init()

Init initializes the application object.

func (*Application) MakeAppServer added in v0.19.0

func (a *Application) MakeAppServer() http.Handler

MakeAppServer creates the handler that serves the application.

This is typically where you create the middleware stack that divides the server into small pieces that each do one job.

The default use the base Application's middleware stack, which itself is quite flexible and has hooks where you can override pieces. Or, you can just replace the whole thing and reimplement it here.

See also the Init function where can assign additional handlers to specific paths via the application muxers.

func (*Application) RunWebServer

func (a *Application) RunWebServer() (err error)

RunWebServer launches the main webserver.

type LocalContext

type LocalContext struct {
}

LocalContext contains the items you want available to

func GetLocalContext added in v0.12.0

func GetLocalContext(ctx context.Context) *LocalContext

Jump to

Keyboard shortcuts

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