Last active
September 19, 2023 03:42
-
-
Save s1s1ty/5b39ecc7fe88e2800c10d87bef06146d to your computer and use it in GitHub Desktop.
1st part
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"github.com/go-chi/chi" | |
"github.com/go-chi/chi/middleware" | |
_ "github.com/go-sql-driver/mysql" | |
) | |
var router *chi.Mux | |
var db *sql.DB | |
const ( | |
dbName = "go-mysql-crud" | |
dbPass = "12345" | |
dbHost = "localhost" | |
dbPort = "33066" | |
) | |
func routers() *chi.Mux { | |
router.Get("/posts", AllPosts) | |
router.Get("/posts/{id}", DetailPost) | |
router.Post("/posts", CreatePost) | |
router.Put("/posts/{id}", UpdatePost) | |
router.Delete("/posts/{id}", DeletePost) | |
return router | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment