Webserver runtime takes port as variable

This commit is contained in:
2021-01-28 08:02:13 -05:00
parent ac6f46345a
commit f17f3d160c
2 changed files with 3 additions and 3 deletions

View File

@ -48,9 +48,9 @@ func getCharacter(w http.ResponseWriter, r *http.Request) {
}
// StartWebserver starts the webserver
func StartWebserver() {
func StartWebserver(port int) {
myRouter := mux.NewRouter().StrictSlash(true)
myRouter.HandleFunc("/health", healthCheck)
myRouter.HandleFunc("/get/character/{user}/{char}", getCharacter)
log.Fatal(http.ListenAndServe(":8081", myRouter))
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", port), myRouter))
}