Skip to content

Commit

Permalink
chore: add error handling for router.Run
Browse files Browse the repository at this point in the history
  • Loading branch information
AnotiaWang committed Feb 28, 2024
1 parent a0dfc50 commit 041a77a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,14 @@ func main() {
handler(c, path)
})

log.Println("Server started at " + host + ":" + port)
router.Run(host + ":" + port)
log.Println("Starting server at " + host + ":" + port)

err := router.Run(host + ":" + port)

if err != nil {
log.Println("Failed to start server: ", err)
os.Exit(1)
}
}

func handler(c *gin.Context, u string) {
Expand Down

0 comments on commit 041a77a

Please sign in to comment.