Added templating, versioning, middleware, etc
This commit is contained in:
11
web/middleware/vars.go
Normal file
11
web/middleware/vars.go
Normal file
@ -0,0 +1,11 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/flamego/template"
|
||||
|
||||
"git.metaunix.net/bitgoblin/blt/app"
|
||||
)
|
||||
|
||||
func CustomVars(data template.Data) {
|
||||
data["app_version"] = app.Version
|
||||
}
|
12
web/routes.go
Normal file
12
web/routes.go
Normal file
@ -0,0 +1,12 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"github.com/flamego/flamego"
|
||||
|
||||
"git.metaunix.net/bitgoblin/blt/web/routes"
|
||||
)
|
||||
|
||||
func RegisterRoutes(f *flamego.Flame) {
|
||||
// index routes
|
||||
f.Get("/", routes.GetDashboard)
|
||||
}
|
12
web/routes/index.go
Normal file
12
web/routes/index.go
Normal file
@ -0,0 +1,12 @@
|
||||
package routes
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/flamego/template"
|
||||
)
|
||||
|
||||
func GetDashboard(t template.Template, data template.Data) {
|
||||
data["title"] = "Dashboard"
|
||||
t.HTML(http.StatusOK, "index/dashboard")
|
||||
}
|
Reference in New Issue
Block a user