A simple ToDo API built with Go to learn Go web development.
📝 演習問題: 各演習ファイルの説明を参照してください
- RESTful API with CRUD operations for ToDo items
- Data validation
- Simple in-memory database (for learning purposes)
- Request handling with standard library and Gorilla Mux
- Go 1.16+
- Gorilla Mux (will be installed via go modules)
# Navigate to project directory
cd go-practice
# Initialize Go modules
go mod init go-practice
# Install dependencies
go get -u github.com/gorilla/mux
# Run development server
go run app/main.go- サーバーの実行: go run app/main.go
- クライアントの実行: go run client.go(別ターミナルで)
- 演習ファイルの実行: go run exercises/ex1_basic_models_solution.go
この環境には以下が含まれています:
- ルーティングやハンドラを備えたRESTful APIサーバー
- サンプルモデルと演習用ファイル
- APIをテストするためのクライアント
- シンプルなテストファイル
Once the server is running, you can:
- Test the API with curl or any API client
- Run the tests:
go test ./tests
GET /todos- List all ToDo itemsGET /todos/{id}- Get a single ToDo itemPOST /todos- Create a new ToDo itemPUT /todos/{id}- Update a ToDo itemDELETE /todos/{id}- Delete a ToDo item