web

package module
v0.0.0-...-dcb3667 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2014 License: MIT Imports: 24 Imported by: 1

README

web

A micro web framework, abstracted from a number of web related projects.

Examples using eikeon/web:

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PERM = regexp.MustCompile("[0-9a-f]{8}~")

Functions

func AddResources

func AddResources(root string)

func CanonicalHost

func CanonicalHost(canonical string) http.HandlerFunc

func Put

func Put(r *Resource)

Types

type Hub

type Hub struct {
	In chan Message

	sync.Mutex
	// contains filtered or unexported fields
}

func NewHub

func NewHub() *Hub

func (*Hub) Add

func (h *Hub) Add(out chan Message)

func (*Hub) Handler

func (h *Hub) Handler() http.Handler

func (*Hub) Remove

func (h *Hub) Remove(out chan Message)

type Message

type Message interface{}

type Resource

type Resource struct {
	URL         string `db:"HASH"`
	Title       string
	Description string
	Photo       string
	Name        string
	Type        string // open graph type
	Static      string
	Up          string
	Canonical   string
	Redirect    string
	Digest      string
	ContentType string
	Size        int64
}

func Get

func Get(url string) (*Resource, error)

func (*Resource) Host

func (r *Resource) Host() string

func (*Resource) Path

func (r *Resource) Path() string

func (*Resource) Site

func (r *Resource) Site() *Resource

type ResourceHandler

type ResourceHandler struct {
	Static  bool
	Root    http.Dir
	Aliases map[string]string
	GetData func(r *Resource) TemplateData `json:"-"`
}

func (*ResourceHandler) Init

func (rh *ResourceHandler) Init(bucket string, host string)

func (*ResourceHandler) Match

func (rh *ResourceHandler) Match(r *http.Request) bool

func (*ResourceHandler) ServeHTTP

func (rh *ResourceHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*ResourceHandler) ServeStatic

func (rh *ResourceHandler) ServeStatic(w http.ResponseWriter, r *http.Request)

func (*ResourceHandler) URL

func (rh *ResourceHandler) URL(r *http.Request) *url.URL

type TemplateData

type TemplateData interface{}

Jump to

Keyboard shortcuts

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