Skip to content

wubrafiq807/go-mysql-revel-rest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-mysql-revel-rest

Example of REST API to create,retrieve,update and delete items with Go,Mysql and Revel framework

Running

To use this sample you must have Go installed as described here, and follow the official Go code organization; MySQL installed and running, if not please check out MySQL download page and follow these instructions.

To check your installations, run the following command in the command line:

$ go version
go version go1.7.1 linux/amd64 # sample output
$ mysql --version
mysql  Ver 14.14 Distrib 5.5.52, for debian-linux-gnu (x86_64) using readline 6. # sample output

Install dependencies

This project uses Revel framework. You can install it by:

go get github.com/revel/revel

go get github.com/revel/cmd/revel

go get gopkg.in/gorp.v2

Set up MySQL database, use -u -p flags to provide username and password:

$  mysql < database_backup.sql

Run

Once Revel framework is installed, you can run the server by:

revel run go-mysql-revel-rest

Note that the project must be located under $GOPATH/src/go-mysql-revel-rest

Routes

The API routes are defined in conf/routes file:

GET /fruits Retrieve all the fruits

GET /fruits/{id} Retrieve a fruit with id {id}

POST /fruits/ Save a new fruit. name and value must be provided as form params.

PUT /fruits/ update a fruit with id {id}. name and value optional as form params.

DELETE /fruits/{id} delete a fruit with id {id}

Technologies

Language - Go
Web framework - Revel
ORM - Gorp
Database - MySQL

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages