Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Echo Quick Start Guide

You're reading from   Echo Quick Start Guide Build lightweight and high-performance web apps with Echo

Arrow left icon
Product type Paperback
Published in May 2018
Publisher Packt
ISBN-13 9781789139433
Length 136 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Ben Huson Ben Huson
Author Profile Icon Ben Huson
Ben Huson
Arrow right icon
View More author details
Toc

Response rendering

As mentioned in Chapter 1, Understanding HTTP, Go, and Echo, the primary purpose of a web application is to take in a request, and render a response to the caller. Fortunately for us, Echo has a multitude of ways we can render responses back to callers. The Echo Context has the following helpers that can be used to render responses, so that you as a developer will not need to serialize the response data yourself:

HTML(code int, html string) error
HTMLBlob(code int, b []byte) error
String(code int, s string) error
JSON(code int, i interface{}) error
JSONPretty(code int, i interface{}, indent string) error
JSONBlob(code int, b []byte) error
JSONP(code int, callback string, i interface{}) error
JSONPBlob(code int, callback string, b []byte) error
XML(code int, i interface{}) error
XMLPretty(code int, i interface{}, indent string) error
XMLBlob(code int, b []byte...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime