()
| 14 | ) |
| 15 | |
| 16 | func main() { |
| 17 | //初始化DotServer |
| 18 | app := dotweb.New() |
| 19 | |
| 20 | //设置dotserver日志目录 |
| 21 | app.SetLogPath(file.GetCurrentDirectory()) |
| 22 | |
| 23 | //这里仅为示例,默认情况下,开启的模式就是development模式 |
| 24 | app.SetDevelopmentMode() |
| 25 | |
| 26 | //使用json标签 |
| 27 | app.HttpServer.SetEnabledBindUseJsonTag(true) |
| 28 | //设置gzip开关 |
| 29 | //app.HttpServer.SetEnabledGzip(true) |
| 30 | |
| 31 | //设置自定义绑定器 |
| 32 | app.HttpServer.SetBinder(newUserBinder()) |
| 33 | |
| 34 | //设置路由 |
| 35 | InitRoute(app.HttpServer) |
| 36 | |
| 37 | //启动 监控服务 |
| 38 | //app.SetPProfConfig(true, 8081) |
| 39 | |
| 40 | // 开始服务 |
| 41 | port := 8080 |
| 42 | fmt.Println("dotweb.StartServer => " + strconv.Itoa(port)) |
| 43 | err := app.StartServer(port) |
| 44 | fmt.Println("dotweb.StartServer error => ", err) |
| 45 | } |
| 46 | |
| 47 | func TestBind(ctx dotweb.Context) error { |
| 48 | type UserInfo struct { |
nothing calls this directly
no test coverage detected