sql.Open() doesn't open anythingWe all know the basic drill of connecting a db in Go: func main(){ //... dsn := flag.String("dsn", "web:password@/demoProject", "MySQL data source name") flag.Parse() db, err := openDB(*dsn) if err Apr 11 · 3 min readareeshzafar.hashnode.dev
(Golang)You've Been Calling It a Handler Wrong All AlongWhen routing in go, we attach a normal function to a router and call it a handler, for example : package main func home(w http.ResponseWriter, r *http.Request) { w.Write([]byte("Hello from SnippeApr 8 · 2 min readareeshzafar.hashnode.dev
How Go's Server Multiplexer Actually Works What is ServeMux in Go? ServeMux is a request router that decides which function should handle an incoming request, it matches the URL of an incoming http request to a set of registered patterns whichApr 7 · 3 min readareeshzafar.hashnode.dev