You're at the end of the sample
You've reached the end of the sample, but in the full version of this book there is loads more information and patterns that you can apply to your own work, including:
- 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, levelled, 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 allow 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.
- Managing CORS requests — How to control cross-origin requests to your API from front-end JavaScript applications.
- 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, automate deployments, and run your API as a background service in production.
Sound good to you? Get the full version now!