I)Prerequisites and Go Variable Settings
To start the installation process, first you need to download Git for Windows and update below required settings for GO environment variables.
1: Go the the link https://git-scm.com/download/win and download the latest version Git for Windows.
Once you click on the Download button for the latest Git for Windows version, the installation exe will be saved to your hard disk. Locate the exe that you’ve just downloaded and run it. Follow the step of installation; once the installation completed you can verify by right click on desktop or any folder. As per below screen-shot.
- 2: The Go-environment works with a small number of OS environment variables. They are best defined before the installation starts; on Windows you will have to create the empty Go root map first, like C:/Go.
GOPATH is a folder in which we will install Beego Framework.
To set GOPATH variables first create new folder in C: drive and update in GOPATH environment variable.
Note: GOPATH folder should not be folder of GOROOT otherwise you will get the error “$GOPATH must not be set to $GOROOT”.
Here are the most important:
GOROOT: is the root of the go tree (or installation)
GOPATH: build and install packages outside the standard Go tree
GOBIN : the location where the binaries (compiler, linker, etc.) are installed
GO to command prompt and navigate the C:Goweb folder.
Now run the command “go get github.com/astaxie/beego”
After this Beego framework starts download.
After download completes you can see 2 new folders in Goweb folder “pkg” and “src”. This will shows that Beego framework has been downloaded successfully on our server.
Now, we need to install bee tool (bee tool is a project that helps developing Beego rapidly. With bee tool we can create, auto compile and reload, develop, test, and deploy Beego applications easily). [It’s just like Php artisan for Laravel in Php.]
From command prompt Go to the C:Gobin
Run the command “go get github.com/beego/bee”
After bee tool installation you will see new bee.exe application.
III)Create First Beego Project
From command prompt Go to the C:Goweb
Run the command “bee new demoProject”
In C:Gowebsrc you will see newly created folder “demoProject”
From command prompt Go to the C:GowebsrcdemoProject
Run the command “bee run watchall”
System will display now alert box just click on “Allow access”. Now, go to browser and hit the url “http://localhost:8080/”.
Note: Do not close the command prompt window.