Skip to content
Snippets Groups Projects
Commit e6ce77dc authored by Andreas Magnarson Nypan's avatar Andreas Magnarson Nypan
Browse files

Upload New File

parent 9e3b2c3f
No related branches found
No related tags found
No related merge requests found
Pipeline #30873 canceled
main.go 0 → 100644
package main
import (
"CountryAPI/handlers"
"CountryAPI/utils"
"log"
"net/http"
"os"
"time"
)
func main() {
utils.StartTime = time.Now() //starting the uptime of the application
port := os.Getenv("PORT")
if port == "" {
log.Println("$PORT has not been set. Default: 8080")
port = "8080"
}
http.HandleFunc("/countryinfo/v1/info/", handlers.HandleCountryInfo)
http.HandleFunc("/countryinfo/v1/population/", handlers.HandlePopulation)
http.HandleFunc("/countryinfo/v1/status/", handlers.HandleStatus)
log.Println("Running on port", port)
err := http.ListenAndServe(":"+port, nil)
if err != nil {
log.Fatal(err.Error())
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment