Golang Learning-the third understanding web framework

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Preface

As a web developer, I believe that the framework is not unfamiliar. So what is a Web framework? What are the frameworks in the language we learn? With these two questions, come into what we are going to write today.

Golang Learning-A brief introduction to the first Golang and installation, deployment in the Windows environment
Golang Learning-The second article builds a simple Go Web server

Body

What is a web framework?

Web application Framework,web Application Framework (Web framework) to support the development of dynamic Web sites, Web applications, and Web services.
The Web application framework helps ease the workload of common activities during web development, such as providing database access interfaces, standard templates, and session management for many frameworks, which can improve code reuse.

Recognize the framework in the Go language

Web frameworks, especially a good web framework, allow us to reduce a lot of hassle in developing projects. However, as a novice golang, remember must not be framed to bind, go to the foundation must learn. Of course this is not the subject we are discussing today.
There are a lot of web frameworks in Golang, for performance comparison, I do not make a special statement here, if you are interested, you can google some of the tests of Daniel. If you have the ability, you can do a test yourself and write a test report. Today, we will briefly introduce a few of the more frameworks that we are currently using.
Beego
Martini
Gin
Revel
As a novice golang, I used the first framework is Beego, the main reason to choose her is simple, easy to use, comprehensive documentation. Let's take a brief look at the Beego framework.

Introduction and construction of Beego framework

Beego Introduction

Beego is a fast-developing HTTP framework for GO applications that can be used to quickly develop applications such as APIs, Web and backend services, and is a RESTful framework designed to be inspired by the three frameworks of tornado, Sinatra and flask, but with the go A framework designed for some of its own characteristics (interface, struct embedding, etc.)

Beego Architecture, Execution logic


Beego Frame composition
Beego Execution Logic diagram

Features of the Beego framework

Simplistic

RESTful support, MVC model, you can use the Bee tool to quickly develop applications, including monitoring code modifications for hot compilation, automated test code, and automated packaging deployment.

Intelligent

Support Intelligent routing, intelligent Monitoring, can monitor QPS, memory consumption, CPU usage, and goroutine health, so that your online application is in control.

Modular

Beego has built-in powerful modules, including sessions, cache operations, logging, configuration parsing, performance monitoring, contextual operations, ORM modules, request emulation and other powerful modules to support any of your applications.

Performance

Beego uses the Go native HTTP package to handle requests, Goroutine's concurrency is high enough to handle large-volume WEB applications and API applications, and is now used in a large number of highly concurrent products.

Installation of Beego

go get github.com/astaxie/beego

Bee Tool Installation

The Bee tool is a project created to assist in the rapid development of BEEGO projects, bee you can easily create, heat compile, develop, test, and deploy Beego projects.
go get github.com/beego/bee
After installation, the bee executable is stored by default in the $GOPATH/bin, so you need to add $GOPATH/bin to your environment variables before you can proceed to the next step.

After completing the above two installations, the BEEGO environment is basically completed. We can create a simple project to run a bit.


Go to cmd command, select your go working directory, execute bee new myfirstproject then Myfirstproject project creation Success


Execute bee run myfirstproject Run Myfirstproject if the project runs successfully


Browser input http://localhost:8080 If the access is successful!

Beego for specific use please visit Beego official website to view the documentation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.