Echo Quick Start Guide
上QQ阅读APP看书,第一时间看更新

What this book covers

Chapter 1, Understanding HTTP, Go, and Echo, covers a high-level understanding of HTTP, Go, and the Echo framework. We explain how the Go HTTP standard library is structured and what useful primitives are included. By reviewing what features the standard library contains for HTTP requests, responses, and handling of requests, how using a web framework can improve the quality and robustness of your application will be evident. Also covered are some of the internals of the standard library web server and comparisons with Echo. Finally, we also cover initial environment setup in order for the reader to become immediately productive.

Chapter 2, Exploring Routing Capabilities, pes into a very fast and high-level tour of the major functionality of the Echo framework, and discusses around an optimal Echo project setup. Starting with the most basic Echo handler and working through an example application, we show the features and capabilities of Echo very briefly.

Chapter 3, Implementing Middleware, discusses one of the most common problems in web application development, which is how to appropriately map the resource described in the URL path to the actual code that represents the resource. Within this chapter, we will explain how Echo's routing engine works and provide real examples of how the routing capabilities within Echo perform better than other web frameworks in the space.

Chapter 4, Developing Echo Projects, covers request and response processing pipelines within Echo. By using middleware, we show how you can simplify your handler code by breaking handler units of work into middleware functions. We also explain how middleware chaining works and what to expect when you use middleware in Echo.

 Chapter 5, Utilizing the Request Context and Data Bindings, explains how context is used within the Echo framework. Context within the Echo framework allows for simplification of otherwise difficult information passing. Since context is built into the handler function signature, your code will always have access to this construct. This chapter also investigates a few mechanisms related to the context, which are request binding and response rendering. The chapter shows examples of how to accomplish as well as some related best practices.

Chapter 6, Performing Logging and Error Handling, exposes to the reader an often-overlooked but critically important aspect of application design: logging and error handling. This chapter provides real examples of how logging and error handling can work within your Echo-based web applications.

Chapter 7, Testing Applications, marches into effective testing techniques for testing a web application API. We will start with some definitions of various forms of testing and then progress into test implementations. There are also neat tricks shown within the chapter to provide you with more information about coverage numbers from external testing.

Chapter 8, Providing Templates and Static Content, goes over how to interact with Echo's file serving capabilities in order to provide static content to your callers. By building on Go's html/template package, we also go into depth on how to make the most of dynamic template rendering.