It is a just simple RESTful API with Go using:
- gorilla/mux
- gorm
# Download this project
$ go get github.com/dedidot/simple-api-golang
# Download Mux Router
$ go get github.com/gorilla/mux
# Download GORM
$ go get github.com/jinzhu/gorm
# Download stringer / generate random id
$ go get github.com/dedidot/generate/stringerSetting DB in config/database.go
func GetConfig() *Config {
	return &Config{
		DB: &DBConfig{
			Dialect:  "mysql",
			Username: "root",
			Password: "",
			Name:     "testinger",
			Charset:  "utf8",
		},
	}
}# Build and Run
cd simple-api-golang
go build
./simple-api-golang
# API Endpoint : http://127.0.0.1:8000├── app
│   ├── routes.go                   // Router
│   ├── controllers                 // Our API core handlers
│   │   ├── ActionPostBook.go       
│   │   ├── ActionViewBook.go       
│   └── models
│   |   └── book.go     // APi Model
|   └── utils
|       └── utils.go // generate id
├── config
│   └── database.go        // Configuration
├── migrate
|   └── book.go // Models for our application
└── main.go
- GET: Get all book
- POST: Create a new book
- GET: Get a book
- PUT: Update a book
- DELETE: Delete a book
#Post Params
{
	"author": "Op Super John Doe Bilw",
	"name": "Implementation Golang",
	"category": "Knowledge"
}
# Inspired By
github.com/mingrammer/go-todo-rest-api-example