protoview

package
v0.0.0-...-f4c7a8f Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2014 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Enable easy and fast http prototype to go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrototypeFromFile

func PrototypeFromFile(file string, fallback http.Handler) http.Handler

Load the prototype form the given config file every time a request hits the returned handler.

Usually the returned handler is registered under "/"

Types

type Config

type Config struct {
	// The alias map
	Alias map[string]string
	// Data to be used inside the template
	Data interface{}
}

The configuration of a given url

type Prototype

type Prototype struct {
	// Urls configuration
	Urls map[string]*Config
}

Hold the configuration of the prototype

func (*Prototype) CanHandle

func (p *Prototype) CanHandle(req *http.Request) bool

Check if the prototype can handle the given request

func (*Prototype) ServeHTTP

func (p *Prototype) ServeHTTP(w http.ResponseWriter, req *http.Request)

Render the prototype to the http response

Jump to

Keyboard shortcuts

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