1
0
mirror of https://github.com/labstack/echo.git synced 2025-03-21 21:27:04 +02:00

Updated docs

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2015-10-11 14:15:07 -07:00
parent 5f01299246
commit ba4a01049d
2 changed files with 17 additions and 3 deletions
website/content/guide

@ -66,6 +66,15 @@ Context.JSON(code int, v interface{}) error
Sends a JSON HTTP response with status code.
### JSONP
```go
Context.JSONP(code int, callback string, i interface{}) error
```
Sends a JSONP HTTP response with status code. It uses `callback` to construct the
JSONP payload.
### XML
```go
@ -93,11 +102,12 @@ Sends a text/plain HTTP response with status code.
### File
```go
Context.File(name string, attachment bool) error
Context.File(name, path string, attachment bool) error
```
File sends a response with the content of the file. If attachment is `true`, the client
is prompted to save the file.
File sends a response with the content of the file. If `attachment` is set
to `true`, the client is prompted to save the file with provided `name`,
name can be empty, in that case name of the file is used.
### Static files

@ -21,6 +21,10 @@ e.Get("/hello", func(c *echo.Context) error {
})
```
You can use `Echo.Any(path string, h Handler)` to register a handler for all HTTP methods.
To register it for some methods, use `Echo.Match(methods []string, path string, h Handler)`.
Echo's default handler is `func(*echo.Context) error` where `echo.Context` primarily
holds HTTP request and response objects. Echo also has a support for other types
of handlers.