This repository provides a base project to implemet Todolist application.
docker-compose.yml
provides Go 1.17 build tool, MySQL server and phpMyAdmin.
First, you need to start Docker containers.
$ docker-compose up -d
When you finish exercise, please don't forget to stop the containers.
$ docker-compose down
When you modify the database schema, you will need to discard the current DB volumes for creating a new one. It will be easier to rebuild everything than to rebuild only DB container. Following command helps you to do it.
$ docker-compose down --rmi all --volumes --remove-orphans
$ docker-compose up -d
Official site: https://jmoiron.github.io/sqlx/
-
Query Parameters:
/user?id=123
router.GET("/user", func(ctx *gin.Context) { id := ctx.Query("id") })
-
Path Parameters:
/user/123
router.GET("/user/:id", func(ctx *gin.Context) { id := ctx.Param("id") })
ちなみに以下のような場合でも path parameter は正しく動作する
tasks/:id/edit
router.GET("/tasks/:id/edit", func(ctx *gin.Context) { id := ctx.Param("id") })
.
├── Dockerfile
├── Makefile
├── README.md
├── assets
│ ├── script.js
│ └── style.css
├── db
│ ├── conn.go
│ └── entity.go
├── docker
│ └── db
├── docker-compose.yml
├── go.mod
├── go.sum
├── main.go
├── service
│ ├── default.go
│ ├── task.go
│ └── user.go
├── tmp
│ ├── build-errors.log
│ └── main
└── views
├── _footer.html
├── _header.html
├── change_password_form.html
├── error.html
├── form_edit_task.html
├── form_new_task.html
├── index.html
├── new_user_form.html
├── task.html
└── task_list.html