Title: Let's Go Further: Advanced patterns for building APIs and web applications in Go Edition: 1.18.2

Author(s): Edwards, Alex

Year: 2022 May 8

Pages: 586

Topic: Computers>Programming: Programming Languages



E-Book Mutual Aid

Read e-books

Edition ID: 141881524

Added: 2022-07-13 10:34:15

Modified: 2022-11-07 04:57:21

Changes history


Edit record

Report an error

Add to the list

Add request

Add a file

Let's Go Further guides you through the start-to-finish build of a modern JSON API in Go – from project setup to deployment in production.
As well as covering fundamental topics like sending and receiving JSON data, the book goes in-depth and explores practical code patterns and best practices for advanced functionality like implementing graceful shutdowns, managing background tasks, reporting metrics, and much more.
You’ll learn a lot about topics that are often important to your real-world work, but which are rarely discussed in beginner-level courses and aren't fully explained by the official Go documentation. Let's Go Further also goes beyond development. It outlines tools and techniques to help manage your project on an ongoing basis, and also gives you a step-by-step playbook for deploying your API to a live production server.
By the end of the book you'll have all the knowledge you need to create robust and professional APIs which act as backends for
SPAs and native mobile applications, or function as stand-alone services.

1. Introduction
1.1. Prerequisites
2. Getting Started
2.1. Project Setup and Skeleton Structure
2.2. A Basic HTTP Server
2.3. API Endpoints and RESTful Routing
3. Sending JSON Responses
3.1. Fixed-Format JSON
3.2. JSON Encoding
3.3. Encoding Structs
3.4. Formatting and Enveloping Responses
3.5. Advanced JSON Customization
3.6. Sending Error Messages
4. Parsing JSON Requests
4.1. JSON Decoding
4.2. Managing Bad Requests
4.3. Restricting Inputs
4.4. Custom JSON Decoding
4.5. Validating JSON Input
5. Database Setup and Configuration
5.1. Setting up PostgreSQL
5.2. Connecting to PostgreSQL
5.3. Configuring the Database Connection Pool
6. SQL Migrations
6.1. An Overview of SQL Migrations
6.2. Working with SQL Migrations
7. CRUD Operations
7.1. Setting up the Movie Model
7.2. Creating a New Movie
7.3. Fetching a Movie

7.4. Updating a Movie
7.5. Deleting a Movie
8. Advanced CRUD Operations
8.1. Handling Partial Updates
8.2. Optimistic Concurrency Control
8.3. Managing SQL Query Timeouts
9. Filtering, Sorting, and Pagination
9.1. Parsing Query String Parameters
9.2. Validating Query String Parameters
9.3. Listing Data
9.4. Filtering Lists
9.5. Full-Text Search
9.6. Sorting Lists
9.7. Paginating Lists
9.8. Returning Pagination Metadata
10. Structured Logging and Error Handling
10.1. Structured JSON Log Entries
10.2. Panic Recovery
11. Rate Limiting
11.1. Global Rate Limiting
11.2. IP-based Rate Limiting
11.3. Configuring the Rate Limiters
12. Graceful Shutdown
12.1. Sending Shutdown Signals
12.2. Intercepting Shutdown Signals
12.3. Executing the Shutdown
13. User Model Setup and Registration
13.1. Setting up the Users Database Table
13.2. Setting up the Users Model
13.3. Registering a User
14. Sending Emails
14.1. SMTP Server Setup
14.2. Creating Email Templates
14.3. Sending a Welcome Email
14.4. Sending Background Emails
14.5. Graceful Shutdown of Background Tasks
15. User Activation
15.1. Setting up the Tokens Database Table
15.2. Creating Secure Activation Tokens
15.3. Sending Activation Tokens
15.4. Activating a User
16. Authentication
16.1. Authentication Options
16.2. Generating Authentication Tokens
16.3. Authenticating Requests
17. Permission-based Authorization
17.1. Requiring User Activation
17.2. Setting up the Permissions Database Table
17.3. Setting up the Permissions Model
17.4. Checking Permissions
17.5. Granting Permissions
18. Cross Origin Requests
18.1. An Overview of CORS
18.2. Demonstrating the Same-Origin Policy
18.3. Simple CORS Requests
18.4. Preflight CORS Requests
19. Metrics
19.1. Exposing Metrics with Expvar
19.2. Creating Custom Metrics
19.3. Request-level Metrics
19.4. Recording HTTP Status Codes
20. Building, Versioning and Quality Control
20.1. Creating and Using Makefiles
20.2. Managing Environment Variables
20.3. Quality Controlling Code
20.4. Module Proxies and Vendoring
20.5. Building Binaries
20.6. Managing and Automating Version Numbers
21. Deployment and Hosting
21.1. Creating a Digital Ocean Droplet
21.2. Server Configuration and Installing Software
21.3. Deployment and Executing Migrations
21.4. Running the API as a Background Service
21.5. Using Caddy as a Reverse Proxy
22. Appendices
22.1. Managing Password Resets
22.2. Creating Additional Activation Tokens
22.3. Authentication with JSON Web Tokens
22.4. JSON Encoding Nuances
22.5. JSON Decoding Nuances
22.6. Request Context Timeouts
23. Feedback
Add the review/rating