MCPcopy Create free account
hub / github.com/devfeel/dotweb / main

Function main

example/bind/main.go:16–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14)
15
16func 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
47func TestBind(ctx dotweb.Context) error {
48 type UserInfo struct {

Callers

nothing calls this directly

Calls 9

NewFunction · 0.92
GetCurrentDirectoryFunction · 0.92
newUserBinderFunction · 0.85
SetDevelopmentModeMethod · 0.80
SetBinderMethod · 0.80
StartServerMethod · 0.80
InitRouteFunction · 0.70
SetLogPathMethod · 0.65

Tested by

no test coverage detected