chore: 新增Static方法

This commit is contained in:
tangtanglove
2023-02-11 10:37:00 +08:00
parent c87054c590
commit fd84dc1b17
3 changed files with 17 additions and 7 deletions

View File

@@ -23,19 +23,24 @@ func main() {
},
}
// 创建对象
// 实例化对象
b := builder.New(config)
// 初始化安装
// 静态文件
b.Static("/", "./website")
// 自动构建数据库、拉取静态文件
b.Use(install.Handle)
// 中间件
// 后台中间件
b.Use(middleware.Handle)
// 响应Get请求
b.GET("/", func(ctx *builder.Context) error {
ctx.Write([]byte("hello world!"))
return nil
})
// 启动服务
b.Run(":3000")
}