2022-10-20 16:59:33 +00:00
|
|
|
package controllers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"GoWeb/app"
|
|
|
|
"GoWeb/templating"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
// GetController is a wrapper struct for the App struct
|
|
|
|
type GetController struct {
|
|
|
|
App *app.App
|
|
|
|
}
|
|
|
|
|
|
|
|
func (getController *GetController) ShowHome(w http.ResponseWriter, r *http.Request) {
|
|
|
|
type dataStruct struct {
|
|
|
|
Test string
|
|
|
|
}
|
|
|
|
|
|
|
|
data := dataStruct{
|
|
|
|
Test: "Hello World!",
|
|
|
|
}
|
|
|
|
|
|
|
|
templating.RenderTemplate(getController.App, w, "templates/pages/home.html", data)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (getController *GetController) ShowRegister(w http.ResponseWriter, r *http.Request) {
|
|
|
|
templating.RenderTemplate(getController.App, w, "templates/pages/register.html", nil)
|
|
|
|
}
|
2022-11-01 16:23:44 +00:00
|
|
|
|
|
|
|
func (getController *GetController) ShowLogin(w http.ResponseWriter, r *http.Request) {
|
|
|
|
templating.RenderTemplate(getController.App, w, "templates/pages/login.html", nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (getController *GetController) Logout(w http.ResponseWriter, r *http.Request) {
|
|
|
|
templating.RenderTemplate(getController.App, w, "templates/pages/register.html", nil)
|
|
|
|
}
|