Revel is a high-productivity, extremely flexible web framework for the Go language which provides routing, parameter parsing, validation, session/flash, templating, caching, job running, a testing framework, and even internationalization and lots more. Revel provides the flexibility of custom Server, Session and Template engines.
There are many REST frameworks built on top of GoLang e.g. “Gin”, “Martini”, “Beego”, etc. Among them, Revel seems to provide best quality for extendibility and flexibility. Here we will explain the steps to setup Revel development environment and build a sample REST webservice.
Setup GO project path:
Let’s assume you don’t have GOPATH setup on your system. The following steps will help you setup the same.
$ mkdir ~/go_codebase $ export GOPATH=~/go_codebase $ echo export GOPATH=$GOPATH >> ~/.bash_profile
Install Ravel Framework:
The following command will install the “Ravel” framework & required command-line tools to your GOPATH along with all other dependencies by Ravel.
# install revel framework $ go get github.com/revel/revel # install revel framework command-line tool $ go get github.com/revel/cmd/revel
Create & Start Revel application:
Now your system should be ready to create the first Revel application. Running following commands will create a skeleton Revel application and start the webserver on port 42163. You should be able to access the application via browser using the following link: http://localhost:9000
# create application $ cd $GOPATH $ revel new test-revel-app # run applicaiton webserver $ revel run -a test-revel-app