editor

package
v0.0.0-...-02fd228 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2017 License: GPL-3.0 Imports: 11 Imported by: 0

README

Codeform editor

The editor is a Google App Engine app. To run it, download the Google App Engine SDK for Go and in a terminal, run goapp serve.

NOTE: This might change to the gcloud command soon - if you find this has happened, please submit a PR correcting this notice.

Documentation

Overview

Package editor provides the editor web tool. To run with Google App Engine, install the Google App Engine Go SDK and go `goapp serve` in this directory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() http.Handler

New makes a new http.Handler that provides the editor.

func Param

func Param(ctx context.Context, param string) string

Param gets the path parameter from the specified Context. Returns an empty string if the parameter was not found.

Types

type Contexter

type Contexter interface {
	Context(*http.Request) context.Context
}

Contexter gets a context for a specific request.

func ContexterBackground

func ContexterBackground() Contexter

ContexterBackground gets a Contexter that provides context.Background().

type ContexterFunc

type ContexterFunc func(*http.Request) context.Context

ContexterFunc is a function wrapper for Contexter.

func (ContexterFunc) Context

func (fn ContexterFunc) Context(r *http.Request) context.Context

Context gets a context for the specified request.

type Handler

type Handler interface {
	ServeHTTP(ctx context.Context, w http.ResponseWriter, r *http.Request) error
}

Handler is http.Handler with context.

type HandlerFunc

type HandlerFunc func(ctx context.Context, w http.ResponseWriter, r *http.Request) error

HandlerFunc is http.HandlerFunc with context.

func (HandlerFunc) ServeHTTP

func (h HandlerFunc) ServeHTTP(ctx context.Context, w http.ResponseWriter, r *http.Request) error

type Router

type Router struct {

	// NotFound is the http.Handler to call when no routes
	// match. By default uses http.NotFoundHandler().
	NotFound http.Handler

	// OnSystemError is called when a handler returns an error.
	OnSystemError func(context.Context, http.ResponseWriter, *http.Request, error)
	// contains filtered or unexported fields
}

Router routes HTTP requests.

func NewRouter

func NewRouter() *Router

NewRouter makes a new Router.

func (*Router) Handle

func (r *Router) Handle(method, pattern string, handler Handler)

Handle adds a handler with the specified method and pattern. Method can be any HTTP method string or "*" to match all methods. Pattern can contain path segments such as: /item/:id which is accessible via Param(context, "id"). If pattern ends with trailing /, it acts as a prefix. Errors returned from handlers are considered system errors and are handled via Router.OnSystemError.

func (*Router) HandleFunc

func (r *Router) HandleFunc(method, pattern string, fn HandlerFunc)

HandleFunc is the http.HandlerFunc alternative to http.Handle.

func (*Router) ServeHTTP

func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP routes the incoming http.Request based on method and path extracting path parameters as it goes.

Directories

Path Synopsis
Package defaultsource provides a staple source from which templates may be written.
Package defaultsource provides a staple source from which templates may be written.

Jump to

Keyboard shortcuts

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