| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- package main
- //import (
- // DEATH "github.com/vrecan/death"
- // "go-framework/baize"
- // "go-tools/api_binding/http_binding"
- // "go-tools/api_binding/http_binding/binding_context"
- // "syscall"
- //)
- //type Hello struct {
- // What string `json:"what"`
- //}
- func main() {
- //app, err := baize.NewApplication("10000", WithDB(config))
- //if err != nil {
- // panic(err)
- //}
- //
- //app.RegisterRouter("root", middlewares...).
- // BindRoute(binding, &http_binding.SimpleBindItem[any, map[string]any]{
- // Path: "/version",
- // ResponseFunc: response.SendMapResponse,
- // BusinessFunc: func(c *binding_context.Context, inputModel any) (map[string]any, error) {
- // return map[string]any{
- // "version": "v1.0.0",
- // }, nil
- // },
- // })
- //
- //app.RegisterRouter("v1", middlewares...).
- // BindPost(binding, &http_binding.SimpleBindItem[Hello, map[string]any]{
- // Path: "/hello",
- // ResponseFunc: response.SendMapResponse,
- // BusinessFunc: func(c *binding_context.Context, inputModel Hello) (map[string]any, error) {
- // return map[string]any{
- // "version": application.GetVersionService().Version(),
- // }, nil
- // },
- // })
- //
- //go func() {
- // err := app.Start()
- // if err != nil {
- // panic(err)
- // }
- //}()
- //
- //defer func() {
- // err := app.Finish()
- // if err != nil {
- // panic(err)
- // }
- //}()
- //
- //death := DEATH.NewDeath(syscall.SIGINT, syscall.SIGTERM)
- //_ = death.WaitForDeath()
- }
|