diff --git a/main.go b/main.go
index 15b9a36..363a60e 100644
--- a/main.go
+++ b/main.go
@@ -29,9 +29,12 @@ func main() {
store := session.New()
engine := html.New("./views", ".html")
+
app := fiber.New(fiber.Config{
Views: engine,
+ ViewsLayout: "layouts/main",
})
+
app.Use(logger.New())
app.Use(recov.New())
@@ -91,8 +94,8 @@ func main() {
app.Static("/", "./public")
- app.Get("/test/", func (c *fiber.Ctx) error {
- return c.Render("index", fiber.Map{
+ app.Get("/test/:name/", func (c *fiber.Ctx) error {
+ return c.Render(c.Params("name"), fiber.Map{
"Title": "Hello, World!",
})
})
diff --git a/public/index.html b/public/index.html
index 33b1a24..572d2fc 100644
--- a/public/index.html
+++ b/public/index.html
@@ -8,7 +8,6 @@
ZedShaw's Game Thing
-
🏡 Zed's Game Dev Website Yay
diff --git a/tests/base_test.go b/tests/base_test.go
index 43fb606..f10a642 100644
--- a/tests/base_test.go
+++ b/tests/base_test.go
@@ -12,14 +12,14 @@ func TestLogin(t *testing.T) {
ctx, cancel := Setup(5); defer cancel()
Run(assert, ctx,
- browser.Navigate(`http://127.0.0.1:5002/login/`),
- browser.WaitVisible(`body > footer`),
- browser.WaitVisible(`[data-testid="login-page"]`),
- browser.SendKeys(`#username`, `zedshaw`),
- browser.SendKeys(`#password`, `1234`),
- browser.Click(`#login-submit`, browser.NodeVisible),
- browser.WaitVisible(`body > footer`),
- browser.WaitVisible(`[data-testid="home-page"]`))
+ browser.Navigate(`http://127.0.0.1:5002/login/`),
+ browser.WaitVisible(`body > footer`),
+ browser.WaitVisible(`[data-testid="login-page"]`),
+ browser.SendKeys(`#username`, `zedshaw`),
+ browser.SendKeys(`#password`, `1234`),
+ browser.Click(`#login-submit`, browser.NodeVisible),
+ browser.WaitVisible(`body > footer`),
+ browser.WaitVisible(`[data-testid="home-page"]`))
}
func TestStreamPage(t *testing.T) {
diff --git a/views/layouts/main.html b/views/layouts/main.html
index 2a25c30..c5afed6 100644
--- a/views/layouts/main.html
+++ b/views/layouts/main.html
@@ -1,7 +1,11 @@
-
+
- Main
+
+
+
+
+ {{.Title}}