app

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

The app package 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 PutContext

func PutContext(ctx context.Context) context.Context

PutContext 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

Create 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()

func (*Application) MakeServerMux

func (a *Application) MakeServerMux() *http.ServeMux

func (*Application) PutContext

func (a *Application) PutContext(r *http.Request) *http.Request

PutContext allocates a blank context object for our application specific context data, to be populated later. Activate it by uncommenting the function below, and then edit the accompanying context.go file to add your application specific context data.

func (*Application) RunWebServer

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

type Context

type Context struct {
	page.Context // standard context stuff goradd requires

	// Your per-request stuff, like per-request instances or dependency injections
	LocalContext
}

type LocalContext

type LocalContext struct {
}

LocalContext contains the items you want available to

func GetContext

func GetContext(ctx context.Context) *LocalContext

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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