Tango is a micro and pluggable web framework built with Golang. It has powerful routing and flexible route combinations, dependency injection embedded, and allows direct integration with existing services. This article will show you how to install and use Tango on Ubuntu 14.04.
If you do not have Golang installed, install Golang using the directions in this article. This may also work on other distros but results will vary.
Install Dependencies
You can skip this step if you have already installed the version controls. Golang will require you to install git
, bzr
, and/or mercurial
. This may be needed if you are downloading libraries from a version control system that is using one of those protocols.
apt-get update
apt-get dist-upgrade -y
apt-get install git bzr mercurial -y
Once everything is installed, you can proceed to the next step.
Install Tango
To install Tango, run the following command:
go get github.com/lunny/tango
If everything went well, you can proceed to the next step. If there was an error, verify your GOPATH
by running go env
and checking its path. If your project is outside of the GOPATH
, and you get a warning about it, you can safely ignore it.
Using Tango
To use Tango, create a file called server.go
and populate it with the following lines of code:
package main
import (
"github.com/lunny/tango"
)
func main() {
t := tango.Classic()
t.Get("/", func() string {
return "Hello from AKLWEB HOST Server!"
})
t.Run()
}
Afterwards, run go run server.go
.
Switch over to your web browser and type http://[SERVER_IP]:8000/
. Replace [SERVER_IP]
with the IP address of your VPS.
If your installation was successful, you will see “Hello from AKLWEB HOST Server!” in your browser.