Whole-book reading guide from stratified index samples; jump to passages in the text
Tip the Site
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat Pay
Alipay
Open WeChat or Alipay and scan. No login required.
AI guide
【One-Line Pitch】
A hands-on, start-to-finish guide to building a production-grade JSON API in Go — covering REST routing, PostgreSQL, authentication, rate limiting, and deployment. Best for developers who already know Go basics and want to ship a real backend service.
【Book Arc】
- **Opening (~0%–12%)**: Sets up the Greenlight project — a movie-management JSON API — and maps the full endpoint surface, tooling, and conventions before any code is written.
- **Early (~12%–29%)**: Establishes prerequisites (Go 1.16, curl, hey, git) and the project skeleton, then stands up a basic HTTP server with configuration via flags and dependency injection.
- **Middle (~29%–65%)**: Builds the core request/response layer — JSON encoding and decoding, input validation, PostgreSQL connection pooling, SQL migrations, and full CRUD operations including partial updates and optimistic concurrency.
- **Late (~65%–90%)**: Layers on production concerns: filtering/sorting/pagination, structured logging, panic recovery, rate limiting, graceful shutdown, user registration, email, activation, authentication, and permission-based authorization.
- **Ending (~90%–100%)**: Covers CORS, metrics, build/versioning/quality control with Makefiles, and deployment to a Digital Ocean Linux server behind Caddy as a reverse proxy.
【Key Takeaways】
- **The book is a build-along, not a reference** (Opening): every concept is introduced through the Greenlight API, so the value comes from coding alongside rather than reading passively.
- **JSON handling is treated as a first-class concern** (Early–Middle): fixed-format vs. encoded responses, enveloping, custom encoding/decoding, and structured error messages are all covered in depth.
- **Database work goes beyond basic CRUD** (Middle): connection pool configuration, SQL migrations, partial updates, optimistic concurrency control, and query timeouts are all addressed as production necessities.
- **List endpoints need real engineering** (Middle–Late): filtering, full-text search, sorting, pagination, and pagination metadata are handled as a cohesive feature set rather than afterthoughts.
- **Operational concerns are woven throughout** (Late): structured logging, panic recovery, rate limiting, and graceful shutdown appear as part of the build, not as a separate appendix.
- **Authentication and authorization are distinct layers** (Late): the book separates user activation, token-based authentication, and permission-based authorization into clear stages.
- **Deployment is part of the book, not an afterthought** (Ending): server provisioning, background services, reverse proxy setup, and automated migrations round out the lifecycle.
- **The book assumes prior Go fluency** (Early): testing and fundamentals are deliberately omitted because they were covered in the predecessor volume, *Let's Go*.
【Reading Tips】
- **Code along from the start**: the skeleton structure, configuration pattern, and application struct are reused throughout; skipping the setup makes later chapters harder to follow.
- **Deep-read the JSON and database chapters**: these contain the most transferable patterns for any Go API, not just the Greenlight project.
- **Skim the deployment chapter if you already have infrastructure experience**: the Digital Ocean and Caddy specifics are useful but environment-dependent.
- **Treat the appendices as a reference**: password resets, JWT authentication, and JSON nuances are supplementary and can be consulted as needed.
- **Don't skip the "additional information" sections**: they contain context that isn't essential to the build but is valuable for understanding trade-offs.
【Coverage Limits】
The excerpts cover the table of contents and early-to-middle chapters in detail, but later chapters (authentication, authorization, CORS, metrics, deployment) are represented mainly by their headings; specific implementation details for those stages are not fully visible in the source material.
Page 5
ceful Shutdown of Background Tasks 15. User Activation 15.1. Setting up the Tokens Database Table 15.2. Creating Secure Activation Tokens 15.3. Sending Activ...
as been omitted. func sayHello() { fmt.Println("Hello world!") } Terminal (command line) instructions are shown with a black background and generally start w...
e the go mod init command to enable modules for the project. When running this command you’ll need to specify a module path, which is essentially a unique id...
declare our project dependencies, versions and module path. The Makefile will contain recipes for automating common administrative tasks — like auditing our...
e") fmt.Fprintf(w, "environment: %s\n", app.config.env) fmt.Fprintf(w, "version: %s\n", version) } The important thing to point out here is that healthcheckH...
h the /v1/healthcheck endpoint in this chapter. Chapter 2.3. API Endpoints and RESTful Routing Over the next few sections of this book we’re going to gradual...
application instance and calling the routes() method on it. The next thing that we need to do is update the main() function to remove the http.ServeMux decla...
the current URL and include it in a placeholder // response. func (app *application) showMovieHandler(w http.ResponseWriter, r *http.Request) { // When httpr...
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.
Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat PayAlipay
Open WeChat or Alipay and scan. No login required.
Add Tag
Enter tag name (max 50 characters)
Share E-Book
Lets Go Further (Alex Edwards)(Z-Library)
Scan QR code with your phone to access
Copy the link or scan the QR code to access this e-book on your phone
Share to WeChat Moments
Lets Go Further (Alex Edwards)(Z-Library)
Scan the QR code with WeChat to open this book
Tap the ··· menu in the top-right corner
Choose Share to Moments
You are already in WeChat. Tap ··· in the top-right corner and choose Share to Moments.
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
Lets Go Further (Alex Edwards)(Z-Library)
Find Your Favorite Books
Only registered users can comment after logging in. Comments need to be reviewed by administrators before being displayed
这本书围绕如何用 Go 语言构建一个可用的 Web API 展开,作者 Alex Edwards 从项目搭建讲起,逐步深入到路由、模块管理和后台任务处理等主题。从目录和摘录来看,全书以实践为导向,读者会跟随书中的步骤建立一个 HTTP 服务器,并在此基础上添加 API 端点,形成一条从骨架结构到具体功能实现的完整路径。
读者可以抓住的第一条线索是项目结构与工具链的起步。书中介绍了用 go mod init 命令为项目启用模块,并说明模块命名的一种社区惯例是基干自己拥有的 URL,同时提醒读者在不确定模块细节时可以查阅官方 Go Modules Wiki。这些内容构成了后续开发的基础,也让读者理解 Go 项目组织方式的基本逻辑。
第二条线索是 HTTP 服务器与路由的设计。摘录中出现了 application 结构体,它包含 config 和 logger,并配合 servemux 注册 /v1/healthcheck 这样的健康检查路由。书中还展示了 showMovieHandler 的写法,说明 httprouter 在解析请求时会提取 URL 中的插值参数。
Digital LibraryAI Assistant
Hi — I can help you pick a book. Tell me a topic, language, or level, e.g. “a light English read”. If that's too broad, I'll ask one follow-up.
Loading comments...
Reply to Comment
Edit Comment