modulepackage
0.0.0-20240508072741-7647e70b7070
Repository: https://github.com/iwind/teago.git
Documentation: pkg.go.dev
# README
TeaGo - Go语言快速开发框架
|------------| |---------| |----------|
| request | -> | router | -> | actions |
|------------| |---------| |----------|
json
templates
databases
定义不带参数的Action
actions/default/hello/index.go
package hello
import "github.com/iwind/TeaGo/actions"
type IndexAction actions.Action
func (this *IndexAction) Run() {
this.WriteString("Hello")
}
定义带参数的Action
actions/default/hello/index.go
package hello
import "github.com/iwind/TeaGo/actions"
type IndexAction actions.Action
func (this *IndexAction) Run(params struct {
Name string
Age int
}) {
this.WriteFormat("Name:%s, Age:%d",
params.Name,
params.Age)
}
注册Action
package MyProject
import (
"github.com/iwind/TeaGo"
"github.com/iwind/MyProject/actions/default/hello/index"
)
func Start() {
var server = TeaGo.NewServer()
// 注册路由
server.Get("/hello", new(hello.IndexAction))
// 启动服务
server.Start("0.0.0.0:8000")
}
# Packages
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Functions
BeforeStart 在服务启动之前执行一个函数.
BeforeStop 在服务停止之前执行一个函数.
NewServer 构建一个新的Server.
# Structs
No description provided by the author
No description provided by the author
Server Web服务.
ServerConfig 服务配置.
ServerRoutePattern 路由配置.
ServerStaticDir 静态资源目录.
# Interfaces
No description provided by the author