A RESTful API example for simple todo application with Go and Angular 6
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)
# Download this project
go get github.com/vikram06/GoAngularBefore 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 GoAngular
go build
./GoAngular
# API Endpoint : http://127.0.0.1:3000βββ 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
GET: Get all projectsPOST: Create a new project
GET: Get a projectPUT: Update a projectDELETE: Delete a project
PUT: Archive a projectDELETE: Restore a project
GET: Get all tasks of a projectPOST: Create a new task in a project
GET: Get a task of a projectPUT: Update a task of a projectDELETE: Delete a task of a project
PUT: Complete a task of a projectDELETE: Undo a task of a project
- Organize the code with packages
- Angular Project
- Support basic REST APIs. (GOLANG)
- Support Authentication with user for securing the APIs.
- Make convenient wrappers for creating API handlers.
- Write the tests for all APIs.
- Make docs with GoDoc
- Building a deployment process