dingo

package module
v0.0.0-...-85db763 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2013 License: MIT Imports: 4 Imported by: 2

README

dingo

An experimental web framework for Go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderTemplate

func RenderTemplate(w http.ResponseWriter, templateName string, data interface{})

Types

type AHandler

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

func NewHandler

func NewHandler(method string, path string, controller Controller) *AHandler

func (*AHandler) HandleRequest

func (handler *AHandler) HandleRequest(w http.ResponseWriter, r *http.Request)

func (*AHandler) SatisfiesRequest

func (handler *AHandler) SatisfiesRequest(r *http.Request) bool

type ARouter

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

func NewRouter

func NewRouter() *ARouter

func (*ARouter) AddHandler

func (router *ARouter) AddHandler(handler *AHandler)

func (*ARouter) Route

func (router *ARouter) Route(w http.ResponseWriter, r *http.Request)

func (*ARouter) SetHandlers

func (router *ARouter) SetHandlers(handlers []*AHandler)

type Config

type Config struct {
	Port        string
	TemplateDir string
	StaticDir   string
	Routes      []*AHandler
}

type Controller

type Controller interface {
	Respond(http.ResponseWriter, *http.Request, map[string]string)
}

type Handler

type Handler interface {
	// returns whether or not the Handler wants to act on the give request
	// can take into account path requested, method (GET, POST), etc.
	SatisfiesRequest(*http.Request) bool

	// handles a given request, generally by passing it to a controller
	Handle(*http.Request)
}

type Router

type Router interface {
	// routes the given request to a controller
	GetController(*http.Request) Controller

	// routes a request to its appropriate handler
	Route(*http.Request)
}

type Server

type Server struct {
	Router *ARouter
}

func New

func New(config Config) *Server

func (*Server) Run

func (server *Server) Run()

type Viewer

type Viewer interface {
	// takes an arbitrary struct and writes a
	// representation of it to the the http response
	Render(http.ResponseWriter, interface{})
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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