# Beego

beego是用于快速开发RESTFUL API，web应用和后端服务。灵感来自于Tornado，Sinatra和Flask。beego具有一些特定于Go的功能，例如接口和结构嵌入。

## 官方网站

{% embed url="<https://beego.me/>" %}

## 项目地址

{% embed url="<https://github.com/astaxie/beego>" %}

## 快速开始

下载和安装

```
go get -u -v github.com/astaxie/beego
```

例子：简单的beego服务

```go
package main

import (
	"github.com/astaxie/beego"
)

type HelloController struct {
	beego.Controller
}

func (c HelloController) SayHello() {
	c.SetData(map[string]string{"say": "hello"})
	c.ServeJSON()
}

func main() {
	beego.Router("/hello", &HelloController{}, "get:SayHello")
	beego.Run("localhost:8080")
}
```

执行`go run main.go`启动服务

开启一个新的控制台执行命令`curl 127.0.0.1:8080/hello`

客户端返回结果

```
{"say":"hello"}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://golang-2.gitbook.io/handbook/avanced/http/kai-yuan-kuang-jia/beego.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
