package main import ( "Advertisement_Panel/src" "fmt" "html/template" "net/http" ) var templ *template.Template func main() { templ, _ = template.ParseGlob("templates/*.html") fmt.Print("Now running server!\n") // Serves index http.HandleFunc("/", index_handler) // Serves json for html to find file names http.HandleFunc("/files", src.FileHandler) // Serves ascii page http.HandleFunc("/ascii", ascii_handler) // Serves images http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("./static")))) // Serves what ever the user is requesting base on above urls http.ListenAndServe(":8080", nil) } func index_handler(w http.ResponseWriter, r *http.Request) { templ.ExecuteTemplate(w, "images.html", nil) } func ascii_handler(w http.ResponseWriter, r *http.Request) { templ.ExecuteTemplate(w, "ascii.html", nil) }