21 lines
392 B
Go
21 lines
392 B
Go
package main
|
|
|
|
import "git.yuntuo.hk/k2safe/go-omni"
|
|
|
|
func main() {
|
|
app := omni.New(omni.WithLogger(true))
|
|
|
|
app.GET("/health", func(ctx *omni.Context) error {
|
|
return ctx.OK(map[string]string{"status": "ok"})
|
|
})
|
|
|
|
api := app.Group("/api")
|
|
api.GET("/users/:id", func(ctx *omni.Context) error {
|
|
return ctx.OK(map[string]string{
|
|
"id": ctx.Param("id"),
|
|
})
|
|
})
|
|
|
|
_ = app.Run(":8080")
|
|
}
|