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, 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 their content.
SQL migrations—How to use SQL migrations to 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 partial updates (with optimistic concurrency control).
Filtering, sorting, and pagination—How to support filtering, sorting, and pagination of data in your API endpoints.
Full-text search—How to use PostgreSQL’s full-text search functionality to perform natural-language searches of your data.
Rate-limiting—How to limit requests to your API on a per-client basis.
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 addresses, and managing password resets.
Authentication—How to authenticate users with both stateful bearer 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 auditing —Building and auditing— How to combine Go’s tooling and Makefiles to easily audit your code, build binaries, and vendor dependencies.
Versioning—How to leverage Git to apply 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 systems.