From 21be0be896dc9780c98d0a6e158953cf4c099d66 Mon Sep 17 00:00:00 2001 From: Musselman Date: Tue, 5 Dec 2023 19:40:19 -0600 Subject: [PATCH] Change HTTP routing for index and add new route for About page rendering --- main.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index f0399b4..9df97ae 100644 --- a/main.go +++ b/main.go @@ -108,7 +108,8 @@ func main() { // Web server initializer func initHTTPServer() { - http.HandleFunc("/", AboutPage) + http.HandleFunc("/", HomePage) + http.HandleFunc("/about", AboutPage) http.HandleFunc("/signup", Signup) http.HandleFunc("/login", Login) http.HandleFunc("/home", ListFiles) @@ -170,10 +171,14 @@ func handleInternalServerError(w http.ResponseWriter, err error) { 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) } +func AboutPage(w http.ResponseWriter, r *http.Request) { + renderTemplate(w, "about.html", nil) +} + func newUser(w http.ResponseWriter, r *http.Request) { renderTemplate(w, "newuser.html", nil) }