func UprnHandler(w http.ResponseWriter, r *http.Request) {
	uprn := mux.Vars(r)["uprn"]
	dpa, err := FetchDpaInfo(uprn, APIKey)
	if err != nil {
		if err.Error() == ErrorUprnNotFound {
			http.Error(w, fmt.Sprintf("UPRN %s not found", uprn), http.StatusNotFound)
		} else {
			http.Error(w, err.Error(), http.StatusInternalServerError)
		}
		return
	}
	data := struct {
		Number, Road, Town, Postcode string
	}{
		Number:   dpa.BUILDINGNUMBER,
		Road:     capitalise(dpa.THOROUGHFARENAME),
		Town:     capitalise(dpa.POSTTOWN),
		Postcode: strings.ToUpper(dpa.POSTCODE),
	}
	t, err := template.New("webpage").Parse(tmpl)
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
	}

	err = t.Execute(w, data)
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
	}
}
//UprnHandler responds to requests for property information
UprnHandler responds to requests for property information
// UprnHandler responds to requests for property information
func UprnHandler(w http.ResponseWriter, r *http.Request) {
	uprn := mux.Vars(r)["uprn"]
	dpa, err := FetchDpaInfo(uprn, APIKey)
	if err != nil {
		if err.Error() == ErrorUprnNotFound {
			http.Error(w, fmt.Sprintf("UPRN %s not found", uprn), http.StatusNotFound)
		} else {
			http.Error(w, err.Error(), http.StatusInternalServerError)
		}
		return
	}
	data := struct {
		Number, Road, Town, Postcode string
	}{
		Number:   dpa.BUILDINGNUMBER,
		Road:     capitalise(dpa.THOROUGHFARENAME),
		Town:     capitalise(dpa.POSTTOWN),
		Postcode: strings.ToUpper(dpa.POSTCODE),
	}
	t, err := template.New("webpage").Parse(tmpl)
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
	}
	err = t.Execute(w, data)
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
	}
}
func UprnHandler ( w http . ResponseWriter , r * http . Request ) { uprn := mux . Vars ( r ) [ " " ] dpa , err := FetchDpaInfo ( uprn , APIKey ) if err != nil { if err . Error ( ) == ErrorUprnNotFound { http . Error ( w , fmt . Sprintf ( " " , uprn ) , http . StatusNotFound ) } else { http . Error ( w , err . Error ( ) , http . StatusInternalServerError ) } return } data := struct { Number , Road , Town , Postcode string } { Number : dpa . BUILDINGNUMBER , Road : capitalise ( dpa . THOROUGHFARENAME ) , Town : capitalise ( dpa . POSTTOWN ) , Postcode : strings . ToUpper ( dpa . POSTCODE ) , } t , err := template . New ( " " ) . Parse ( tmpl ) if err != nil { http . Error ( w , err . Error ( ) , http . StatusInternalServerError ) } err = t . Execute ( w , data ) if err != nil { http . Error ( w , err . Error ( ) , http . StatusInternalServerError ) } }
UprnHandler responds to requests for property information
UprnHandler responds to requests for property information