update: X-Trace-Id
This commit is contained in:
@ -2,7 +2,9 @@ package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/loveuer/nf"
|
||||
"github.com/loveuer/nf/nft/resp"
|
||||
"time"
|
||||
"ultone/internal/handler"
|
||||
"ultone/internal/middleware/auth"
|
||||
@ -21,9 +23,13 @@ func initApp(ctx context.Context) *nf.App {
|
||||
// todo: add project prefix, if you need
|
||||
// for example: app := engine.Group("/api/{project}")
|
||||
app := engine.Group("/api")
|
||||
app.Get("/available", func(c *nf.Ctx) error {
|
||||
return c.JSON(nf.Map{"status": 200, "ok": true, "time": time.Now()})
|
||||
})
|
||||
app.Get("/available", func() nf.HandlerFunc {
|
||||
start := time.Now()
|
||||
return func(c *nf.Ctx) error {
|
||||
now := time.Now()
|
||||
return resp.Resp200(c, nf.Map{"ok": true, "start": start, "now": now, "duration": fmt.Sprint(now.Sub(start))})
|
||||
}
|
||||
}())
|
||||
|
||||
{
|
||||
api := app.Group("/user")
|
||||
|
Reference in New Issue
Block a user