Skip to content

Commit

Permalink
Merge pull request #7 from tinh-tinh/fix/ren/6-bug-init-app
Browse files Browse the repository at this point in the history
fix: bug init app
  • Loading branch information
Ren0503 authored Nov 19, 2024
2 parents 1e8b25d + eb5c9f4 commit f6f5944
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ bin

.idea/
.vscode/
*.iml
*.iml
coverage/
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.PHONY: test-coverage

test-coverage:
go test -v ./... -covermode=count -coverpkg=./... -coverprofile coverage/coverage.out
go tool cover -html coverage/coverage.out -o coverage/coverage.html
12 changes: 6 additions & 6 deletions tpl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)
func main() {
server := core.CreateFactory(app.NewModule, "api")
server := core.CreateFactory(app.NewModule)
server.Listen(3000)
}
Expand Down Expand Up @@ -62,23 +62,23 @@ import "github.com/tinh-tinh/tinhtinh/core"
func NewController(module *core.DynamicModule) *core.DynamicController {
ctrl := module.NewController("{{ .ModName }}")
ctrl.Post("/", func(ctx core.Ctx) error {
ctrl.Post("", func(ctx core.Ctx) error {
return ctx.JSON(core.Map{"data": "ok"})
})
ctrl.Get("/", func(ctx core.Ctx) error {
ctrl.Get("", func(ctx core.Ctx) error {
return ctx.JSON(core.Map{"data": "ok"})
})
ctrl.Get("/{id}", func(ctx core.Ctx) error {
ctrl.Get("{id}", func(ctx core.Ctx) error {
return ctx.JSON(core.Map{"data": "ok"})
})
ctrl.Put("/{id}", func(ctx core.Ctx) error {
ctrl.Put("{id}", func(ctx core.Ctx) error {
return ctx.JSON(core.Map{"data": "ok"})
})
ctrl.Delete("/{id}", func(ctx core.Ctx) error {
ctrl.Delete("{id}", func(ctx core.Ctx) error {
return ctx.JSON(core.Map{"data": "ok"})
})
Expand Down

0 comments on commit f6f5944

Please sign in to comment.