Documentation ¶
Overview ¶
Package goexpress helps reading and setting the cookie The cookie struct's instance is availaible to both goexpress.Request and goexpress.Response
Package goexpress provides the actual hook that enables you to start building your application.
The basic Express() functions returns an instance for the express which can be further be used as an express hook.
app.Use(), app.Get(), app.Post(), app.Delete(), app.Push() app.Put() are the top level functions that can be used in the same fashion as the express-js ones are.
Package goexpress header handles the Response & Request Header The package is responsible for setting Response headers and pushing the same on the transport buffer
Package goexpress provides the request structure The package provides access to Headers, Cookies Query Params, Post Body and Upload Files
Package goexpress package provides the core functionality of handling the client connection, chunked response and other features
Package goexpress /router returns instance for express Router Functions defined here are extended by express.go itself
Express Router takes the url regex as similar to the js one Router.Get("/:param") will return the param in Response.Params["param"]
Index ¶
Constants ¶
const MaxBufferSize int64 = 1024 * 1024
MaxBufferSize is a const type
Variables ¶
This section is empty.
Functions ¶
func CompileRegex ¶
CompileRegex is a Helper which returns a golang RegExp for a given express route string
Types ¶
type Cookie ¶
type Cookie interface { Add(cookie *http.Cookie) Cookie Del(name string) Cookie Get(name string) string GetAll() map[string]*http.Cookie }
Cookie defines HTTP Cookie interface
type EntrySet ¶
type EntrySet struct {
// contains filtered or unexported fields
}
EntrySet defines a map entry set
type ExpressInterface ¶ added in v1.0.2
type ExpressInterface interface { Use(interface{}) ExpressInterface Get(string, Middleware) ExpressInterface Post(string, Middleware) ExpressInterface Put(string, Middleware) ExpressInterface Patch(string, Middleware) ExpressInterface Delete(string, Middleware) ExpressInterface SetProp(string, interface{}) ExpressInterface GetProp(string, interface{}) interface{} Start(string) ExpressInterface ShutdownTimeout(t time.Duration) ExpressInterface BeforeShutdown(func(e ExpressInterface)) ExpressInterface Shutdown(ctx context.Context) error }
ExpressInterface is the Public Interface to allow access to express struct's member functions
type File ¶
type File struct { Name string FormName string Mime textproto.MIMEHeader File multipart.File Reader *multipart.Part }
File contains the reader to read the buffer content of uploading file
type Header ¶
type Header interface { Set(key string, value string) Header Get(key string) string Del(key string) Header SetStatus(code int) BasicSent() bool CanSendHeader() bool FlushHeaders() bool }
Header defines HTTP header interface
type Middleware ¶
Middleware function singature type
type NextFunc ¶
type NextFunc func(NextFunc)
NextFunc is an extension type to help loop of lookup in express.go
type Request ¶
type Request interface { // IsMultipart takes header value and boundary string and returns true if its a multipart IsMultipart(header string, boundary *string) bool // GetRaw returns the raw http Request GetRaw() *http.Request // URL returns the http URL URL() *url.URL // Cookie returns a cookie object to read from Cookie() Cookie // Header returns header set to read from Header() *EntrySet // Params returns a params set Params() *EntrySet // Method defines the HTTP request method Method() string // Body returns form key value list Body(key string) []string // Query returns query key value list Query(key string) []string // JSON returns json decoder for a json input body JSON() *json.Decoder // IsJSON tells if a request has json body IsJSON() bool // Files returns all the files attached with the request Files() []*File }
Request defines the HTTP request interface
type Response ¶
type Response interface { Cookie() Cookie Header() Header JSON(content interface{}) Error(status int, str string) GetBuffer() *bufio.ReadWriter GetConnection() net.Conn GetRaw() http.ResponseWriter Redirect(url string) Response End() Download(path string, fileName string) bool SendFile(url string, noCache bool) bool WriteBytes(bytes []byte) error Write(content string) Response Render(path string, data interface{}) }
Response defines HTTP response wrapper interface
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
A Route contains a regexp and a Router.Middleware type handler
type Router ¶
type Router interface { Get(url string, middleware Middleware) Router Post(url string, middleware Middleware) Router Put(url string, middleware Middleware) Router Patch(url string, middleware Middleware) Router Delete(url string, middleware Middleware) Router Use(middleware interface{}) Router GetRoutes() map[string][]*Route }
Router is an interface wrapper