2017-11-25 17:23:46 +00:00
|
|
|
# Beego [![Build Status](https://travis-ci.org/astaxie/beego.svg?branch=master)](https://travis-ci.org/astaxie/beego) [![GoDoc](http://godoc.org/github.com/astaxie/beego?status.svg)](http://godoc.org/github.com/astaxie/beego) [![Foundation](https://img.shields.io/badge/Golang-Foundation-green.svg)](http://golangfoundation.org) [![Go Report Card](https://goreportcard.com/badge/github.com/astaxie/beego)](https://goreportcard.com/report/github.com/astaxie/beego)
|
|
|
|
|
2020-12-13 07:30:07 +00:00
|
|
|
Beego is used for rapid development of enterprise application in Go, including RESTful APIs, web apps and backend
|
|
|
|
services.
|
2013-06-19 14:27:21 +00:00
|
|
|
|
2020-12-13 07:30:07 +00:00
|
|
|
It is inspired by Tornado, Sinatra and Flask. beego has some Go-specific features such as interfaces and struct
|
|
|
|
embedding.
|
2012-12-16 15:43:42 +00:00
|
|
|
|
2020-12-13 11:09:58 +00:00
|
|
|
![architecture](https://cdn.nlark.com/yuque/0/2020/png/755700/1607857489109-1e267fce-d65f-4c5e-b915-5c475df33c58.png)
|
2020-12-13 07:41:52 +00:00
|
|
|
|
|
|
|
Beego is compos of four parts:
|
|
|
|
1. Base modules: including log module, config module, governor module;
|
|
|
|
2. Task: is used for running timed tasks or periodic tasks;
|
|
|
|
3. Client: including ORM module, httplib module, cache module;
|
|
|
|
4. Server: including web module. We will support gRPC in the future;
|
|
|
|
|
|
|
|
## Quick Start
|
|
|
|
|
2020-12-12 14:04:26 +00:00
|
|
|
[Officail website](http://beego.me)
|
2020-12-13 07:41:52 +00:00
|
|
|
|
2020-12-12 14:04:26 +00:00
|
|
|
[Example](https://github.com/beego-dev/beego-example)
|
2020-11-12 13:36:11 +00:00
|
|
|
|
2020-12-12 14:04:26 +00:00
|
|
|
> If you could not open official website, go to [beedoc](https://github.com/beego/beedoc)
|
2020-11-12 13:36:11 +00:00
|
|
|
|
2013-06-22 11:17:50 +00:00
|
|
|
|
2020-10-08 15:17:38 +00:00
|
|
|
### Web Application
|
|
|
|
|
2020-12-13 11:09:58 +00:00
|
|
|
![Http Request](https://cdn.nlark.com/yuque/0/2020/png/755700/1607857462507-855ec543-7ce3-402d-a0cb-b2524d5a4b60.png)
|
2020-12-13 07:30:07 +00:00
|
|
|
|
2020-07-09 10:14:31 +00:00
|
|
|
#### Create `hello` directory, cd `hello` directory
|
2020-07-09 09:18:01 +00:00
|
|
|
|
2020-07-10 01:58:06 +00:00
|
|
|
mkdir hello
|
|
|
|
cd hello
|
2020-12-13 07:30:07 +00:00
|
|
|
|
2020-07-09 09:18:01 +00:00
|
|
|
#### Init module
|
|
|
|
|
2020-07-10 01:58:06 +00:00
|
|
|
go mod init
|
|
|
|
|
|
|
|
#### Download and install
|
|
|
|
|
2020-12-12 14:04:26 +00:00
|
|
|
go get github.com/astaxie/beego@v2.0.0
|
2020-07-09 09:18:01 +00:00
|
|
|
|
2017-04-02 09:04:08 +00:00
|
|
|
#### Create file `hello.go`
|
2020-12-13 07:30:07 +00:00
|
|
|
|
2015-07-16 04:32:07 +00:00
|
|
|
```go
|
|
|
|
package main
|
|
|
|
|
2020-10-08 15:17:38 +00:00
|
|
|
import "github.com/astaxie/beego/server/web"
|
2015-07-16 04:32:07 +00:00
|
|
|
|
2020-12-13 07:30:07 +00:00
|
|
|
func main() {
|
|
|
|
web.Run()
|
2015-07-16 04:32:07 +00:00
|
|
|
}
|
|
|
|
```
|
2020-12-13 07:30:07 +00:00
|
|
|
|
2017-04-02 09:04:08 +00:00
|
|
|
#### Build and run
|
|
|
|
|
2015-07-16 04:32:07 +00:00
|
|
|
go build hello.go
|
|
|
|
./hello
|
2017-04-02 09:04:08 +00:00
|
|
|
|
|
|
|
#### Go to [http://localhost:8080](http://localhost:8080)
|
|
|
|
|
|
|
|
Congratulations! You've just built your first **beego** app.
|
|
|
|
|
2013-06-22 11:17:50 +00:00
|
|
|
## Features
|
2012-12-16 15:43:42 +00:00
|
|
|
|
2013-12-22 07:56:15 +00:00
|
|
|
* RESTful support
|
2020-12-13 07:30:07 +00:00
|
|
|
* [MVC architecture](https://github.com/beego/beedoc/tree/master/en-US/mvc)
|
2014-08-22 05:32:54 +00:00
|
|
|
* Modularity
|
2020-12-13 07:30:07 +00:00
|
|
|
* [Auto API documents](https://github.com/beego/beedoc/blob/master/en-US/advantage/docs.md)
|
|
|
|
* [Annotation router](https://github.com/beego/beedoc/blob/master/en-US/mvc/controller/router.md)
|
|
|
|
* [Namespace](https://github.com/beego/beedoc/blob/master/en-US/mvc/controller/router.md#namespace)
|
|
|
|
* [Powerful development tools](https://github.com/beego/bee)
|
2014-08-22 05:32:54 +00:00
|
|
|
* Full stack for Web & API
|
2013-06-22 11:17:50 +00:00
|
|
|
|
2020-12-13 07:30:07 +00:00
|
|
|
## Modules
|
|
|
|
* [orm](https://github.com/beego/beedoc/tree/master/en-US/mvc/model)
|
|
|
|
* [session](https://github.com/beego/beedoc/blob/master/en-US/module/session.md)
|
|
|
|
* [logs](https://github.com/beego/beedoc/blob/master/en-US/module/logs.md)
|
|
|
|
* [config](https://github.com/beego/beedoc/blob/master/en-US/module/config.md)
|
|
|
|
* [cache](https://github.com/beego/beedoc/blob/master/en-US/module/cache.md)
|
|
|
|
* [context](https://github.com/beego/beedoc/blob/master/en-US/module/context.md)
|
|
|
|
* [governor](https://github.com/beego/beedoc/blob/master/en-US/module/governor.md)
|
|
|
|
* [httplib](https://github.com/beego/beedoc/blob/master/en-US/module/httplib.md)
|
|
|
|
* [task](https://github.com/beego/beedoc/blob/master/en-US/module/task.md)
|
|
|
|
* [i18n](https://github.com/beego/beedoc/blob/master/en-US/module/i18n.md)
|
2012-12-16 15:43:42 +00:00
|
|
|
|
2014-08-22 05:32:54 +00:00
|
|
|
## Community
|
2012-12-17 05:33:32 +00:00
|
|
|
|
2014-08-22 05:32:54 +00:00
|
|
|
* [http://beego.me/community](http://beego.me/community)
|
2020-12-13 07:30:07 +00:00
|
|
|
* Welcome to join us in Slack: [https://beego.slack.com](https://beego.slack.com), you can get invited
|
|
|
|
from [here](https://github.com/beego/beedoc/issues/232)
|
2019-10-10 03:23:19 +00:00
|
|
|
* QQ Group Group ID:523992905
|
2020-12-13 07:30:07 +00:00
|
|
|
* [Contribution Guide](https://github.com/beego/beedoc/blob/master/en-US/intro/contributing.md).
|
2013-06-21 08:40:58 +00:00
|
|
|
|
2017-04-02 09:04:08 +00:00
|
|
|
## License
|
2013-06-22 11:17:50 +00:00
|
|
|
|
2016-01-13 14:20:34 +00:00
|
|
|
beego source code is licensed under the Apache Licence, Version 2.0
|
2014-08-22 05:32:54 +00:00
|
|
|
(http://www.apache.org/licenses/LICENSE-2.0.html).
|