Skip to content
Snippets Groups Projects
Select Git revision
  • f61a72d0b657974eaa385aa6b9a9af63e48424c0
  • main default protected
  • backup-includeCitiesInInfo
  • includeCitiesInInfo
  • statusEndPoint
  • KombinereAPI
6 results

main.go

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    main.go 656 B
    package main
    
    import (
    	"fmt"
    	"net/http"
    	"time"
    	"git.gvk.idi.ntnu.no/Mathilde/cloud/handelers"
    )
    
    var serviceStartTime time.Time
    
    
    func main() {
    	serviceStartTime = time.Now()
    
    	http.HandleFunc("/status/", func(w http.ResponseWriter, r *http.Request) {
    		handelers.DiagnosticsHandler(w, r, serviceStartTime)
    	})
    	http.HandleFunc("/", handelers.HomeHandler)
    	http.HandleFunc("/countryinfo/v1/info/", handelers.CountryInfoHandler)
    	http.HandleFunc("/population/", handelers.PopulationHandler)
    
    
    	fmt.Println("Server running on port 8080...")
    	if err := http.ListenAndServe(":8080", nil); err != nil {
    		fmt.Printf("Server failed to start: %s\n", err)
    	}
    }