close DB in mysql-blog-server exmaple

This commit is contained in:
syumai 2024-01-03 23:53:03 +09:00
parent 11042f5762
commit 7025700201

View File

@ -37,6 +37,7 @@ func (h *articleHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
if err != nil {
log.Fatalf("failed to connect: %v", err)
}
defer db.Close()
switch req.Method {
case http.MethodGet: