-
Notifications
You must be signed in to change notification settings - Fork 1
/
routes.go
40 lines (31 loc) · 957 Bytes
/
routes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main
import (
"errors"
"net/http"
"github.com/maverickames/omeh"
)
func (app *App) root(w http.ResponseWriter, r *http.Request) *omeh.ErrResponse {
RenderdView := struct {
Title string
ContentData string
}{
Title: "Title of the current page.",
ContentData: "This is the content data",
}
return app.RenderDefaultTemplate(w, r, "dashboardPlan.html.mustache", RenderdView)
}
func (app *App) brokenRoute(w http.ResponseWriter, r *http.Request) *omeh.ErrResponse {
RenderdView := struct {
Title string
ContentData string
}{
Title: "Page 2 broken route",
ContentData: "This is the content data of the broke route",
}
// faking function return of non nil error
err := errors.New("did something and it broke")
if err != nil {
return app.em.ErrorHandler(err, omeh.StatusInternalServerError, r.RequestURI)
}
return app.RenderDefaultTemplate(w, r, "dashboardPlan.html.mustache", RenderdView)
}