Help us shape the future of Go! Take the 2026 Go Developer Survey

cherry

package module
v0.0.0-...-7fb5353 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

README

Cherry

Cherry is a simple framework for building website.

Documentation

Index

Constants

View Source
const (
	// cherry version.
	VERSION = "0.1.0"
)

Variables

This section is empty.

Functions

func AddHttpErr

func AddHttpErr(code int, f http.HandlerFunc)

func HttpErr

func HttpErr(w http.ResponseWriter, r *http.Request, code int)

Types

type Business

type Business interface {
	Init(resRoot string)
	Handle(w http.ResponseWriter, r *http.Request)
}

type Route

type Route struct {
	Method   string
	Pattern  string
	Business Business
}

type Router

type Router struct {
	Routes []*Route
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter() *Router

func (*Router) AddRoute

func (this *Router) AddRoute(method string, pattern string, b Business)

func (*Router) FindRoute

func (this *Router) FindRoute(method string, urlPath string) *Route

type Server

type Server struct {
	Port    int
	WebRoot string
	ResRoot string
	Name    string
	// contains filtered or unexported fields
}

func NewServer

func NewServer() *Server

func (*Server) RouteDelete

func (this *Server) RouteDelete(pattern string, b Business)

func (*Server) RouteGet

func (this *Server) RouteGet(pattern string, b Business)

func (*Server) RouteHead

func (this *Server) RouteHead(pattern string, b Business)

func (*Server) RoutePatch

func (this *Server) RoutePatch(pattern string, b Business)

func (*Server) RoutePost

func (this *Server) RoutePost(pattern string, b Business)

func (*Server) RoutePut

func (this *Server) RoutePut(pattern string, b Business)

func (*Server) Serve

func (this *Server) Serve()

func (*Server) ServeHTTP

func (this *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Server) ServeTLS

func (this *Server) ServeTLS(certFile string, keyFile string)

Jump to

Keyboard shortcuts

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