mirror of
https://github.com/labstack/echo.git
synced 2025-03-23 21:29:26 +02:00
Updated docs
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
parent
5f01299246
commit
ba4a01049d
@ -66,6 +66,15 @@ Context.JSON(code int, v interface{}) error
|
|||||||
|
|
||||||
Sends a JSON HTTP response with status code.
|
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
|
### XML
|
||||||
|
|
||||||
```go
|
```go
|
||||||
@ -93,11 +102,12 @@ Sends a text/plain HTTP response with status code.
|
|||||||
### File
|
### File
|
||||||
|
|
||||||
```go
|
```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
|
File sends a response with the content of the file. If `attachment` is set
|
||||||
is prompted to save the file.
|
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
|
### 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
|
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
|
holds HTTP request and response objects. Echo also has a support for other types
|
||||||
of handlers.
|
of handlers.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user