Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions tpl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,24 @@ import "github.com/tinh-tinh/tinhtinh/core"
func NewController(module *core.DynamicModule) *core.DynamicController {
ctrl := module.NewController("{{ .ModName }}")

ctrl.Post("/", func(ctx core.Ctx) {
ctx.JSON(core.Map{"data": "ok"})
ctrl.Post("/", func(ctx core.Ctx) error {
return ctx.JSON(core.Map{"data": "ok"})
})

ctrl.Get("/", func(ctx core.Ctx) {
ctx.JSON(core.Map{"data": "ok"})
ctrl.Get("/", func(ctx core.Ctx) error {
return ctx.JSON(core.Map{"data": "ok"})
})

ctrl.Get("/{id}", func(ctx core.Ctx) {
ctx.JSON(core.Map{"data": "ok"})
ctrl.Get("/{id}", func(ctx core.Ctx) error {
return ctx.JSON(core.Map{"data": "ok"})
})

ctrl.Put("/{id}", func(ctx core.Ctx) {
ctx.JSON(core.Map{"data": "ok"})
ctrl.Put("/{id}", func(ctx core.Ctx) error {
return ctx.JSON(core.Map{"data": "ok"})
})

ctrl.Delete("/{id}", func(ctx core.Ctx) {
ctx.JSON(core.Map{"data": "ok"})
ctrl.Delete("/{id}", func(ctx core.Ctx) error {
return ctx.JSON(core.Map{"data": "ok"})
})

return ctrl
Expand Down