1
0
mirror of https://github.com/labstack/echo.git synced 2025-07-17 01:43:02 +02:00

Updated website

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana
2017-04-28 22:24:40 -07:00
parent f3f3e99ba3
commit 883fcb35fb
2 changed files with 12 additions and 51 deletions

View File

@ -87,7 +87,7 @@ func(c echo.Context) error {
### JSON Pretty ### JSON Pretty
`Context#JSONPretty(code int, i interface{}, indent string)` can be used to a send `Context#JSONPretty(code int, i interface{}, indent string)` can be used to a send
a JSON response which is pretty printed based on indent, which could spaces or tabs. a JSON response which is pretty printed based on indent, which could be spaces or tabs.
Example below sends a pretty print JSON indented with spaces: Example below sends a pretty print JSON indented with spaces:
@ -108,33 +108,15 @@ func(c echo.Context) error {
} }
``` ```
Today, `Context#JSON(code int, i interface{})` also can output a pretty printed JSON > You can also use `Context#JSON()` to output a pretty printed JSON (indented with spaces)
(indented with spaces) when a querystring `?pretty` is attached in request URL. by appending `pretty` in the request URL query string.
*Example* *Example*
```go ```sh
func(c echo.Context) error { curl http://localhost:1323/users/1?pretty
u := &User{
Name: "Jon",
Email: "joe@labstack.com",
}
return c.JSON(http.StatusOK, u)
}
``` ```
```bash
curl -fSL http://127.0.0.1:8080/v1/users/123?pretty
```
```js
{
"email": "joe@labstack.com",
"name": "Jon"
}
```
### JSON Blob ### JSON Blob
`Context#JSONBlob(code int, b []byte)` can be used to send pre-encoded JSON blob directly `Context#JSONBlob(code int, b []byte)` can be used to send pre-encoded JSON blob directly
@ -196,7 +178,7 @@ func(c echo.Context) error {
### XML Pretty ### XML Pretty
`Context#XMLPretty(code int, i interface{}, indent string)` can be used to a send `Context#XMLPretty(code int, i interface{}, indent string)` can be used to a send
an XML response which is pretty printed based on indent, which could spaces or tabs. an XML response which is pretty printed based on indent, which could be spaces or tabs.
Example below sends a pretty print XML indented with spaces: Example below sends a pretty print XML indented with spaces:
@ -218,31 +200,13 @@ func(c echo.Context) error {
</User> </User>
``` ```
Today, `Context#XML(code int, i interface{})` also can output a pretty printed XML > You can also use `Context#XML()` to output a pretty printed XML (indented with spaces) by appending
(indented with spaces) when a querystring `?pretty` is attached in request URL. `pretty` in the request URL query string.
*Example* *Example*
```go ```sh
func(c echo.Context) error { curl http://localhost:1323/users/1?pretty
u := &User{
Name: "Jon",
Email: "joe@labstack.com",
}
return c.XML(http.StatusOK, u)
}
```
```bash
curl -fSL http://127.0.0.1:8080/v1/users/123?pretty
```
```xml
<?xml version="1.0" encoding="UTF-8"?>
<User>
<Name>Jon</Name>
<Email>joe@labstack.com</Email>
</User>
``` ```
### XML Blob ### XML Blob
@ -313,9 +277,6 @@ func(c echo.Context) (err error) {
} }
``` ```
// Stream sends a streaming response with status code and content type.
Stream(code int, contentType string, r io.Reader) error
## Send Stream ## Send Stream
`Context#Stream(code int, contentType string, r io.Reader)` can be used to send an `Context#Stream(code int, contentType string, r io.Reader)` can be used to send an

View File

@ -1,6 +1,6 @@
<nav class="w3-sidenav w3-border-right"> <nav class="sidenav w3-border-right">
<div class="w3-container"> <div class="w3-container">
<button class="w3-btn w3-white w3-border w3-border-theme w3-round-xlarge" onclick="location.href='/support-echo';"> <button class="w3-button w3-theme w3-round-large" onclick="location.href='/support-echo';">
<i class="fa fa-heart" aria-hidden="true"></i> Support Echo <i class="fa fa-heart" aria-hidden="true"></i> Support Echo
</button> </button>
{{ $currentNode := . }} {{ $currentNode := . }}