{"modulePath":"github.com/foolin/echo","version":"v2.0.0-beta.2.0.20160322025726-f091ccc9fc8d+incompatible","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package engine\n\n## Types\n\n```go\ntype Config struct {\n\tAddress      string        // TCP address to listen on.\n\tListener     net.Listener  // Custom `net.Listener`. If set, server accepts connections on it.\n\tTLSCertfile  string        // TLS certificate file path.\n\tTLSKeyfile   string        // TLS key file path.\n\tReadTimeout  time.Duration // Maximum duration before timing out read of the request.\n\tWriteTimeout time.Duration // Maximum duration before timing out write of the response.\n}\n```\nConfig defines engine config.\n\n```go\ntype Handler interface {\n\tServeHTTP(Request, Response)\n}\n```\nHandler defines an interface to server HTTP requests via \\`ServeHTTP(Request, Response)\\` function.\n\n```go\ntype HandlerFunc func(Request, Response)\n```\nHandlerFunc is an adapter to allow the use of \\`func(Request, Response)\\` as an HTTP handler.\n\n```go\nfunc (h HandlerFunc) ServeHTTP(rq Request, rs Response)\n```\nServeHTTP serves HTTP request.\n\n```go\ntype Header interface {\n\t// Add adds the key, value pair to the header. It appends to any existing values\n\t// associated with key.\n\tAdd(string, string)\n\n\t// Del deletes the values associated with key.\n\tDel(string)\n\n\t// Set sets the header entries associated with key to the single element value.\n\t// It replaces any existing values associated with key.\n\tSet(string, string)\n\n\t// Get gets the first value associated with the given key. If there are\n\t// no values associated with the key, Get returns \"\".\n\tGet(string) string\n\n\t// Keys returns header keys.\n\tKeys() []string\n}\n```\nHeader defines the interface for HTTP header.\n\n```go\ntype Request interface {\n\t// TLS returns true if HTTP connection is TLS otherwise false.\n\tTLS() bool\n\n\t// Scheme returns the HTTP protocol scheme, `http` or `https`.\n\tScheme() string\n\n\t// Host returns HTTP request host. Per RFC 2616, this is either the value of\n\t// the `Host` header or the host name given in the URL itself.\n\tHost() string\n\n\t// URI returns the unmodified `Request-URI` sent by the client.\n\tURI() string\n\n\t// URL returns `engine.URL`.\n\tURL() URL\n\n\t// Header returns `engine.Header`.\n\tHeader() Header\n\n\t// UserAgent returns the client's `User-Agent`.\n\tUserAgent() string\n\n\t// RemoteAddress returns the client's network address.\n\tRemoteAddress() string\n\n\t// Method returns the request's HTTP function.\n\tMethod() string\n\n\t// SetMethod sets the HTTP method of the request.\n\tSetMethod(string)\n\n\t// Body returns request's body.\n\tBody() io.Reader\n\n\t// FormValue returns the form field value for the provided name.\n\tFormValue(string) string\n\n\t// FormFile returns the multipart form file for the provided name.\n\tFormFile(string) (*multipart.FileHeader, error)\n\n\t// MultipartForm returns the multipart form.\n\tMultipartForm() (*multipart.Form, error)\n}\n```\nRequest defines the interface for HTTP request.\n\n```go\ntype Response interface {\n\t// Header returns `engine.Header`\n\tHeader() Header\n\n\t// WriteHeader sends an HTTP response header with status code.\n\tWriteHeader(int)\n\n\t// Write writes the data to the connection as part of an HTTP reply.\n\tWrite(b []byte) (int, error)\n\n\t// Status returns the HTTP response status.\n\tStatus() int\n\n\t// Size returns the number of bytes written to HTTP response.\n\tSize() int64\n\n\t// Committed returns true if HTTP response header is written, otherwise false.\n\tCommitted() bool\n\n\t// Write returns the HTTP response writer.\n\tWriter() io.Writer\n\n\t// SetWriter sets the HTTP response writer.\n\tSetWriter(io.Writer)\n}\n```\nResponse defines the interface for HTTP response.\n\n```go\ntype Server interface {\n\t// SetHandler sets the handler for the HTTP server.\n\tSetHandler(Handler)\n\n\t// SetLogger sets the logger for the HTTP server.\n\tSetLogger(*log.Logger)\n\n\t// Start starts the HTTP server.\n\tStart() error\n}\n```\nServer defines the interface for HTTP server.\n\n```go\ntype URL interface {\n\t// Path returns the request URL path.\n\tPath() string\n\n\t// SetPath sets the request URL path.\n\tSetPath(string)\n\n\t// QueryParam returns the query param for the provided name.\n\tQueryParam(string) string\n\n\t// QueryString returns the URL query string.\n\tQueryString() string\n}\n```\nURL defines the interface for HTTP request url.\n\n","path":"github.com/foolin/echo/engine","name":"engine","synopsis":"","isRedistributable":true}
