#Go
35 posts
Gin Basics #7 Project Structure and a Mini REST API
Split the code accumulated in one file into layers, separate out configuration, and finish the series with a mini REST API.
Gin Basics #6 Database Integration (GORM)
Attach GORM and build a CRUD API that handles real data. Covers everything from model definition to create, read, update, and delete.
Gin Basics #5 Middleware
How to bundle common processing applied across many handlers — logging, recovery, authentication — into middleware.
Gin Basics #4 Responses — JSON, Status Codes, Errors
Covers response formats beyond JSON, how to handle status codes, and how to build consistent error responses.
Gin Basics #3 Request Binding and Validation
Binding request bodies into structs, and validating input with validator tags.
Gin Basics #2 Routing and Handlers
How to read path parameters and query strings, and how to group endpoints with router groups.
Gin Basics #1 Getting Started and Your First Server
From the gaps you hit with net/http alone to installing Gin and running your first HTTP server. The starting line of the Gin track.
Go Practice #6 Testing and Deployment — httptest and Docker
Handler tests with httptest, integration test patterns, Docker multistage builds, and a small operations checklist.
Go Practice #5 Middleware Patterns
Standard middleware built from chains of http.Handler adapters — logging, auth, panic recovery, request ID, CORS.
Go Practice #4 DB Integration — database/sql and Transactions
database/sql basics, prepared statements, transactions, and connection pool tuning. Plus higher-level tools like sqlc, sqlx, and GORM.
Go Practice #3 JSON I/O and Input Validation
Marshal/Unmarshal in encoding/json, struct tags, decoding error handling, and patterns for safe input validation.
Go Practice #2 Routing — Go 1.22+ ServeMux
Method/pattern matching in the standard ServeMux from Go 1.22+. Where external routers like chi or gorilla/mux still fit.