Code Explainers
Gin code explainers
go
func (h *TransactionHandler) ExportCSV(c *gin.Context) { ctx := c.Request.Context() filters := parseTransactionFilters(c)
Streaming a CSV export in Gin
streaming
csv-export
database-cursor
Intermediate
8 steps
go
package handlers type SignupRequest struct { Email string `json:"email" binding:"required,email"`
Validated signup handler in Gin
request validation
error handling
http status codes
Intermediate
7 steps
go
package handlers import ( "net/http"
Cookie-based sessions in Gin
authentication
cookies
middleware
Intermediate
7 steps
go
package validators import ( "regexp"
Custom validators in Gin
validation
sync.once
regexp
Intermediate
5 steps
go
package webhooks import ( "crypto/hmac"
Verifying GitHub webhooks in Gin
hmac
webhooks
middleware
Intermediate
6 steps
go
package middleware import ( "errors"
Centralized error handling in Gin
middleware
error-handling
custom-errors
Intermediate
8 steps
go
func StreamMetrics(c *gin.Context) { clientGone := c.Request.Context().Done() ticker := time.NewTicker(time.Second) defer ticker.Stop()
Streaming server-sent events in Gin
server-sent-events
streaming
channels
Intermediate
7 steps
go
package handlers import ( "net/http"
Rendering HTML pages with Gin handlers
http-handlers
templating
error-handling
Beginner
8 steps
go
package middleware import ( "net/http"
Building a bearer-token auth middleware in Gin
middleware
authentication
closures
Intermediate
5 steps
go
package handlers import ( "net/http"
Reading path parameters in Gin
routing
path-parameters
wildcards
Beginner
7 steps