Using Tango on Ubuntu 14.04

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 updateapt-get dist-upgrade -yapt-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

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 mainimport (  "")func main() {t := tango.Classic()    t.Get("/", func() string {    return "Hello from Vultr 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 Vultr Server!” in your browser.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article

No comments

Powered by Blogger.