项目
在 GitHub 查看
mingrammer/go-todo-rest-api-example
关于
:books: 使用 Go 构建的简单待办事项应用 RESTful API 示例
学习与教育实测星标增长
- 24小时
- +1
- 7天
- +1
- 15天
- +1
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Go Todo REST API Example
A RESTful API example for simple todo application with Go
It is a just simple tutorial or example for making simple RESTful API with Go using gorilla/mux (A nice mux library) and gorm (An ORM for Go)
Installation & Run
# Download this project
go get github.com/mingrammer/go-todo-rest-api-example
Before running API server, you should set the database config with yours or set the your database config with my values on config.go
func GetConfig() *Config {
return &Config{
DB: &DBConfig{
Dialect: "mysql",
Username: "guest",
Password: "Guest0000!",
Name: "todoapp",
Charset: "utf8",
},
}
}
# Build and Run
cd go-todo-rest-api-example
go build
./go-todo-rest-api-example
# API Endpoint : http://127.0.0.1:3000
Structure
├── app
│ ├── app.go
│ ├── handler // Our API core handlers
│ │ ├── common.go // Common response functions
│ │ ├── projects.go // APIs for Project model
│ │ └── tasks.go // APIs for Task model
│ └── model
│ └── model.go // Models for our application
├── config
│ └── config.go // Configuration
└── main.go
API
/projects
GET: Get all projectsPOST: Create a new project
/projects/:title
GET: Get a projectPUT: Update a projectDELETE: Delete a project
/projects/:title/archive
PUT: Archive a projectDELETE: Restore a project
/projects/:title/tasks
GET: Get all tasks of a projectPOST: Create a new task in a project
/projects/:title/tasks/:id
GET: Get a task of a projectPUT: Update a task of a projectDELETE: Delete a task of a project
/projects/:title/tasks/:id/complete
PUT: Complete a task of a projectDELETE: Undo a task of a project
Todo
- Support basic REST APIs.
- Support Authentication with user for securing the APIs.
- Make convenient wrappers for creating API handlers.
- Write the tests for all APIs.
- Organize the code with packages
- Make docs with GoDoc
- Building a deployment process
探索相关项目
加载中…