package main import ( "html" "log" "net/http" "strings" ) func SeeRouting(w http.ResponseWriter, r *http.Request) { log.Printf("Handling request %s: %s\n", r.Method, r.URL.Path) // Extract URL arguments var sURL = strings.Split(r.URL.Path, "/") if sURL[len(sURL)-1] == "" && len(sURL) > 2 { // Remove trailing / sURL = sURL[:len(sURL)-1] } if len(sURL) < 3 { http.Error(w, "Please provide a valid hash", http.StatusForbidden) } else { w.Header().Set("Content-Type", "text/html") w.Write([]byte(` OhSnap
` + html.EscapeString(`)) if "name" != "" { w.Write([]byte(`
` + html.EscapeString("name") + `
`)) } w.Write([]byte(`
`)) } }