route

package
v0.0.0-...-1ae3dfb Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2017 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IndexHandle

func IndexHandle(w http.ResponseWriter, r *http.Request)

IndexHandle for index page

func LogHandler

func LogHandler(h http.Handler, name string) http.Handler

LogHandler print request trace log

func NewRouter

func NewRouter() *mux.Router

NewRouter return the registered router

func StaticHandler

func StaticHandler(folder string) http.Handler

StaticHandler serve public files, exclude folder

Types

type ResponseLogger

type ResponseLogger struct {
	StatusCode int
	// contains filtered or unexported fields
}

ResponseLogger is a middleware used to keep an copy of Response.StatusCode.

func (*ResponseLogger) Header

func (m *ResponseLogger) Header() http.Header

Header returns the header map that will be sent by WriteHeader. The Header map also is the mechanism with which Handlers can set HTTP trailers.

func (*ResponseLogger) Write

func (m *ResponseLogger) Write(data []byte) (int, error)

Write writes the data to the connection as part of an HTTP reply.

func (*ResponseLogger) WriteHeader

func (m *ResponseLogger) WriteHeader(status int)

WriteHeader sends an HTTP response header with status code. If WriteHeader is not called explicitly, the first call to Write will trigger an implicit WriteHeader(http.StatusOK). Thus explicit calls to WriteHeader are mainly used to send error codes.

type Route

type Route struct {
	Name    string
	Method  []string
	Pattern string
	Handler http.HandlerFunc
}

Route define the basic route

Jump to

Keyboard shortcuts

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