Reader small image

You're reading from  Echo Quick Start Guide

Product typeBook
Published inMay 2018
PublisherPackt
ISBN-139781789139433
Edition1st Edition
Tools
Right arrow
Author (1)
Ben Huson
Ben Huson
author image
Ben Huson

John Huson is an Echo developer
Read more about Ben Huson

Right arrow

Rendering

As mentioned previously, the job of a web application or an API is to create an HTTP response message, given an HTTP request message. Echo has a really nice facility to help us render responses from our handlers and middleware functions. echo.Context has methods which perform all of the heavy hitting for rendering responses back to the caller. As seen in prior examples, there is a JSON method on the Echo Context which allows for rendering of a JSON payload back to the caller. The following is a list of supported rendering capabilities within Echo:

  • HTML: Render an HTML response:

    • HTMLBlob: Render a preformed HTML response

  • JSON: Render a JSON response, converting the variable into JSON based on the struct tags of the variable:

    • JSONBlob: Render a preformed JSON response

    • JSONPretty: Render a pretty JSON response

    • JSONP: Render a JSONP response based on the struct...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Echo Quick Start Guide
Published in: May 2018Publisher: PacktISBN-13: 9781789139433

Author (1)

author image
Ben Huson

John Huson is an Echo developer
Read more about Ben Huson