Skip to content

Commit

Permalink
set routing
Browse files Browse the repository at this point in the history
Signed-off-by: Vivek Kumar Sahu <vivekkumarsahu650@gmail.com>
  • Loading branch information
viveksahu26 committed Feb 9, 2024
1 parent a12d62b commit 146a148
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions cmd/url_shortner/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,17 @@ func main() {
case "server":
serverCmd.Parse(os.Args[2:])
fmt.Printf("Starting server on port %s...\n", *port)
http.HandleFunc("/health", short.HealthCheckUp)
http.HandleFunc("/short-url", short.HandleShortURL)
http.HandleFunc("/long-url", short.HandleLongURL)
// setupRoutes() // Function to set up web routes
setupRoutes()
log.Fatal(http.ListenAndServe(":"+*port, nil))
default:
fmt.Println("expected 'short' or 'server' subcommands")
os.Exit(1)
}
}

// func setupRoutes() {
// http.HandleFunc("/health", src.HealthCheckUp)
// http.HandleFunc("/short-url", src.HandleShortURL)
// http.HandleFunc("/long-url", src.HandleLongURL)
// }
func setupRoutes() {
http.HandleFunc("/health", short.HealthCheckUp)
http.HandleFunc("/short-url", short.HandleShortURL)
http.HandleFunc("/long-url", short.HandleLongURL)
}

0 comments on commit 146a148

Please sign in to comment.