GO - beego installation and new projects (a)

beego Profile

Beego is a rapid development framework http Go application can be used for rapid development of applications Api, web and back-end services, it is a RESTful framework.

beego architecture

Beego constructed from eight independent modules, is a highly decoupled applications, users can not use any of the modules with the inside of beego http logic. Specific architecture design as follows: 

beego execution logic

beego mvc framework is a classic, its execution logic is as follows: 
 
the corresponding project directory structure as follows:

├── conf
│   └── app.conf
├── controllers │ ├── admin │ └── default.go ├── main.go ├── models │ └── models.go ├── static │ ├── css │ ├── ico │ ├── img │ └── js └── views ├── admin └── index.tpl

 

We can see the entrance mian.go file, controllers is a logic control module, models is a model module, views is a view of the module.

beego installation

Installation beego framework is very simple, it can command

go get github.com/astaxie/beego

 

go language at this point I think is doing better, with direct instruction can directly download and install good. Of course, the above command needs to git support. Users can also download the source code is then placed on to the next github under src GOPATH / github.com / astaxie / directory, and go installcan be installed directly.

beego there is a tool to assist in the rapid development of bee beego project, can easily be constructed by bee, hot compiler, development, testing and deployment. 
bee tools you can use to download and install instructions directly go:

go get github.com/beego/bee

 

After some users may install and run the tool in the bee was killed in encounter problems when the system bee, the question of did not explain what the specific reason, users can encounter this problem directly from the github.com/beego/bee Download the latest source clone to hot-fix-support branch GOPATH \ src \ github.com \ beego \ under then checkout, and then execute go installthe instruction manual install. 
carried out

bee version

 

The following information will appear if the installation was successful and functioning:

$ bee version
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \ | |_/ /| __/| __/ \____/ \___| \___| v1.8.1 ├── Beego : Beego is not installed. Please do consider installing it first: https://github.com/astaxie/beego ├── GoVersion : go1.8 ├── GOOS : darwin ├── GOARCH : amd64 ├── NumCPU : 4 ├── GOPATH : /Users/alpher/go ├── GOROOT : /usr/local/Cellar/go/1.8/libexec ├── Compiler : gc └── Date : Wednesday, 5 Apr 2017

Creating beego project

After installing these tools we can directly through bee new projectNameto build a framework of the project beego

$ bee new beegoDemo
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v1.8.1
2017/04/05 10:24:49 INFO     ▶ 0001 Creating application...
    create   /Users/alpher/go/src/beegoDemo/ create /Users/alpher/go/src/beegoDemo/conf/ create /Users/alpher/go/src/beegoDemo/controllers/ create /Users/alpher/go/src/beegoDemo/models/ create /Users/alpher/go/src/beegoDemo/routers/ create /Users/alpher/go/src/beegoDemo/tests/ create /Users/alpher/go/src/beegoDemo/static/ create /Users/alpher/go/src/beegoDemo/static/js/ create /Users/alpher/go/src/beegoDemo/static/css/ create /Users/alpher/go/src/beegoDemo/static/img/ create /Users/alpher/go/src/beegoDemo/views/ create /Users/alpher/go/src/beegoDemo/conf/app.conf create /Users/alpher/go/src/beegoDemo/controllers/default.go create /Users/alpher/go/src/beegoDemo/views/index.tpl create /Users/alpher/go/src/beegoDemo/routers/router.go create /Users/alpher/go/src/beegoDemo/tests/default_test.go create /Users/alpher/go/src/beegoDemo/main.go 2017/04/05 10:24:49 SUCCESS ▶ 0002 New application successfully created!

After the project is created, we need to enter into the project, using bee run projectNamebeego run the newly created project, use bee runthe command aims to reach thermal compile results, real-time view to modify the content of our results.

$ bee run beegoDemo
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v1.8.1
2017/04/05 10:29:29 INFO ▶ 0001 Using 'beegoDemo' as 'appname' 2017/04/05 10:29:29 INFO ▶ 0002 Initializing watcher... beegoDemo/controllers beegoDemo/routers beegoDemo 2017/04/05 10:29:31 SUCCESS ▶ 0003 Built Successfully! 2017/04/05 10:29:31 INFO ▶ 0004 Restarting 'beegoDemo'... 2017/04/05 10:29:31 SUCCESS ▶ 0005 './beegoDemo' is running... 2017/04/05 10:29:31 [I] [asm_amd64.s:2197] http server Running on http://:8080

So that our application has been running the port in 8080, visit localhost: 8080 you can see the effect as follows:

Feel good, give me some money now Ethernet Address: 0xF23FCCbF5A4ee9832CC553c63732BAdfc606A2c2

beego Profile

Beego is a rapid development framework http Go application can be used for rapid development of applications Api, web and back-end services, it is a RESTful framework.

beego architecture

Beego constructed from eight independent modules, is a highly decoupled applications, users can not use any of the modules with the inside of beego http logic. Specific architecture design as follows: 

beego execution logic

beego mvc framework is a classic, its execution logic is as follows: 
 
the corresponding project directory structure as follows:

├── conf
│   └── app.conf
├── controllers │ ├── admin │ └── default.go ├── main.go ├── models │ └── models.go ├── static │ ├── css │ ├── ico │ ├── img │ └── js └── views ├── admin └── index.tpl

 

We can see the entrance mian.go file, controllers is a logic control module, models is a model module, views is a view of the module.

beego installation

Installation beego framework is very simple, it can command

go get github.com/astaxie/beego

 

go language at this point I think is doing better, with direct instruction can directly download and install good. Of course, the above command needs to git support. Users can also download the source code is then placed on to the next github under src GOPATH / github.com / astaxie / directory, and go installcan be installed directly.

beego there is a tool to assist in the rapid development of bee beego project, can easily be constructed by bee, hot compiler, development, testing and deployment. 
bee tools you can use to download and install instructions directly go:

go get github.com/beego/bee

 

After some users may install and run the tool in the bee was killed in encounter problems when the system bee, the question of did not explain what the specific reason, users can encounter this problem directly from the github.com/beego/bee Download the latest source clone to hot-fix-support branch GOPATH \ src \ github.com \ beego \ under then checkout, and then execute go installthe instruction manual install. 
carried out

bee version

 

The following information will appear if the installation was successful and functioning:

$ bee version
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \ | |_/ /| __/| __/ \____/ \___| \___| v1.8.1 ├── Beego : Beego is not installed. Please do consider installing it first: https://github.com/astaxie/beego ├── GoVersion : go1.8 ├── GOOS : darwin ├── GOARCH : amd64 ├── NumCPU : 4 ├── GOPATH : /Users/alpher/go ├── GOROOT : /usr/local/Cellar/go/1.8/libexec ├── Compiler : gc └── Date : Wednesday, 5 Apr 2017

Creating beego project

After installing these tools we can directly through bee new projectNameto build a framework of the project beego

$ bee new beegoDemo
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v1.8.1
2017/04/05 10:24:49 INFO     ▶ 0001 Creating application...
    create   /Users/alpher/go/src/beegoDemo/ create /Users/alpher/go/src/beegoDemo/conf/ create /Users/alpher/go/src/beegoDemo/controllers/ create /Users/alpher/go/src/beegoDemo/models/ create /Users/alpher/go/src/beegoDemo/routers/ create /Users/alpher/go/src/beegoDemo/tests/ create /Users/alpher/go/src/beegoDemo/static/ create /Users/alpher/go/src/beegoDemo/static/js/ create /Users/alpher/go/src/beegoDemo/static/css/ create /Users/alpher/go/src/beegoDemo/static/img/ create /Users/alpher/go/src/beegoDemo/views/ create /Users/alpher/go/src/beegoDemo/conf/app.conf create /Users/alpher/go/src/beegoDemo/controllers/default.go create /Users/alpher/go/src/beegoDemo/views/index.tpl create /Users/alpher/go/src/beegoDemo/routers/router.go create /Users/alpher/go/src/beegoDemo/tests/default_test.go create /Users/alpher/go/src/beegoDemo/main.go 2017/04/05 10:24:49 SUCCESS ▶ 0002 New application successfully created!

After the project is created, we need to enter into the project, using bee run projectNamebeego run the newly created project, use bee runthe command aims to reach thermal compile results, real-time view to modify the content of our results.

$ bee run beegoDemo
______
| ___ \
| |_/ /  ___   ___
| ___ \ / _ \ / _ \
| |_/ /|  __/|  __/
\____/  \___| \___| v1.8.1
2017/04/05 10:29:29 INFO ▶ 0001 Using 'beegoDemo' as 'appname' 2017/04/05 10:29:29 INFO ▶ 0002 Initializing watcher... beegoDemo/controllers beegoDemo/routers beegoDemo 2017/04/05 10:29:31 SUCCESS ▶ 0003 Built Successfully! 2017/04/05 10:29:31 INFO ▶ 0004 Restarting 'beegoDemo'... 2017/04/05 10:29:31 SUCCESS ▶ 0005 './beegoDemo' is running... 2017/04/05 10:29:31 [I] [asm_amd64.s:2197] http server Running on http://:8080

So that our application has been running the port in 8080, visit localhost: 8080 you can see the effect as follows:

Guess you like

Origin www.cnblogs.com/ExMan/p/11402075.html