| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- 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", baize.NewDBPersistence())
- //if err != nil {
- // panic(err)
- //}
- //
- //app.AddRouter("root", middlewares...).
- // GetRouter("root").
- // 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.AddRouter("v1", middlewares...).
- // GetRouter("v1").
- // 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()
- }
|