Let’s Go Further helps you extend and expand your knowledge of Go — taking you beyond the basics and guiding you through advanced patterns for developing, managing and deploying APIs and web applications.
It builds on many of the concepts that were introduced in Let’s Go, and talks through the start-to-finish build of a RESTful JSON API — from initial project setup to deployment in production.
This gives us an opportunity to cover important topics in the context of a complete, working, application — including SQL migrations, CORS requests, permission-based authorization, managing background tasks, reporting metrics, automating build and deployment steps, and much more.
If you enjoyed Let’s Go, this book should be a great fit for you and an ideal next step in mastering Go.
What you'll learn
- Structure and organization — How to implement an idiomatic and flexible code structure for your RESTful API projects.
- JSON responses — How to send JSON responses from your API, how to format and customize them to meet your exact needs, and what common gotchas you need to be aware of.
- JSON requests — How to parse incoming JSON requests, manage bad requests, and restrict and validate the JSON contents.
- SQL migrations — How to use SQL migrations to organize and manage changes to your database schema.
- Database operations — How to set timeouts on your database queries and optimize the behavior of Go's sql.DB connection pool.
- Beyond CRUD — How to perform 'advanced' actions on your API resources, including fetching related data and performing partial updates (with optimistic concurrency control).
- Filtering, sorting and pagination — How to easily support filtering, sorting and pagination of data in your API endpoints.
- Full-text search — How to use PostgreSQL's full-text search functionality to support natural-language searches of your data.
- Structured logging — How to develop a custom logger which writes structured, leveled, log entries in JSON format.
- Rate-limiting — How to implement a simple and robust pattern for enforcing per-client rate limits to your API.
- Managing background tasks — How to safely execute tasks in background goroutines.
- Graceful shutdown — How to set up your API to support graceful shutdowns, including waiting for background tasks to complete.
- Sending emails — How to send emails from your API and manage email content using Go’s new embedded files functionality.
- User activation and password resets — How to build secure workflows for registering users, verifying their email address, and managing password resets.
- Authentication — How to authenticate users with both stateful bearers tokens and stateless JWTs (JSON web tokens).
- Permission-based authorization — How to implement granular permission-based authorization checks on your API endpoints.
- Metrics — How to expose application metrics, including memory use, sql.DB connection pool statistics, response status counts and more.
- Building and auditing — How to use Go's tooling and Makefiles to easily audit your code, build binaries and vendor dependencies.
- Versioning — How to leverage Git to implement automatic application versioning when building binaries.
- Deployment — How to set up a Linux server on Digital Ocean, automate deployments, and run your API as a background service in production using systemd.