Skip to content

Commit

Permalink
handle gin err
Browse files Browse the repository at this point in the history
  • Loading branch information
ariebrainware committed Sep 21, 2020
1 parent a0ac6ca commit 7bc98f9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion config/config.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"Port": 3003,
"Host": "localhost",
"User": "postgres",
"Password": "admin123",
"Database": "paylist",
"Port": 5432,
"DBPort": 5432,
"JWTSignature": "topsecret"
}
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require (
github.com/gin-gonic/gin v1.6.3
github.com/go-playground/validator/v10 v10.3.0 // indirect
github.com/golang/protobuf v1.4.2 // indirect
github.com/google/martian v2.1.0+incompatible
github.com/jinzhu/gorm v1.9.16
github.com/json-iterator/go v1.1.10 // indirect
github.com/kr/pretty v0.2.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/jinzhu/gorm v1.9.16 h1:+IyIjPEABKRpsu/F8OvDPy9fyQlgsg2luMV2ZIH5i5o=
github.com/jinzhu/gorm v1.9.16/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBefADcs=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
Expand Down
8 changes: 6 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type endpoint struct {
}

func main() {
configFile := flag.String("config", "config/dev.json", "Config file path")
configFile := flag.String("config", "config/config.json", "Config file path")
flag.Parse()
if configFile == nil || *configFile == "" {
return
Expand Down Expand Up @@ -70,5 +70,9 @@ func main() {
router.PUT("/user/:id", ep.Auth, ep.UpdateUser)
router.PUT("/editpassword/:id", ep.Auth, ep.EditPassword)
router.DELETE("/user/:id", ep.Auth, ep.DeleteUser)
router.Run(fmt.Sprintf("%d", config.Misc.Port))
err := router.Run(fmt.Sprintf(":%d", config.Misc.Port))
if err != nil {
fmt.Println(err)
return
}
}

0 comments on commit 7bc98f9

Please sign in to comment.