Change HTTP routing for index and add new route for
About page rendering
This commit is contained in:
parent
88ea7a0046
commit
21be0be896
1 changed files with 7 additions and 2 deletions
9
main.go
9
main.go
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue