Change HTTP routing for index and add new route for

About page rendering
This commit is contained in:
James Musselman 2023-12-05 19:40:19 -06:00
parent 88ea7a0046
commit 21be0be896

View file

@ -108,7 +108,8 @@ func main() {
// Web server initializer // Web server initializer
func initHTTPServer() { func initHTTPServer() {
http.HandleFunc("/", AboutPage) http.HandleFunc("/", HomePage)
http.HandleFunc("/about", AboutPage)
http.HandleFunc("/signup", Signup) http.HandleFunc("/signup", Signup)
http.HandleFunc("/login", Login) http.HandleFunc("/login", Login)
http.HandleFunc("/home", ListFiles) http.HandleFunc("/home", ListFiles)
@ -170,10 +171,14 @@ func handleInternalServerError(w http.ResponseWriter, err error) {
log.Printf("Error: %v", err) log.Printf("Error: %v", err)
} }
func AboutPage(w http.ResponseWriter, r *http.Request) { func HomePage(w http.ResponseWriter, r *http.Request) {
renderTemplate(w, "index.html", nil) renderTemplate(w, "index.html", nil)
} }
func AboutPage(w http.ResponseWriter, r *http.Request) {
renderTemplate(w, "about.html", nil)
}
func newUser(w http.ResponseWriter, r *http.Request) { func newUser(w http.ResponseWriter, r *http.Request) {
renderTemplate(w, "newuser.html", nil) renderTemplate(w, "newuser.html", nil)
} }