Added templating, versioning, middleware, etc
This commit is contained in:
17
main.go
17
main.go
@ -5,13 +5,28 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/flamego/flamego"
|
||||
"github.com/flamego/template"
|
||||
|
||||
"git.metaunix.net/bitgoblin/blt/web"
|
||||
"git.metaunix.net/bitgoblin/blt/web/middleware"
|
||||
)
|
||||
|
||||
var Version string = "N/a"
|
||||
|
||||
func main() {
|
||||
// initial Flamego server object
|
||||
f := flamego.Classic()
|
||||
|
||||
f.Get("/{*}", printRequestPath)
|
||||
// initialize templating engine
|
||||
f.Use(template.Templater())
|
||||
|
||||
// inject custom middleware
|
||||
f.Use(middleware.CustomVars)
|
||||
|
||||
// register routes to server (moved to separate file for cleanliness)
|
||||
web.RegisterRoutes(f)
|
||||
|
||||
// alert the user and start the server
|
||||
log.Println("Server is running...")
|
||||
log.Println(http.ListenAndServe("0.0.0.0:2830", f))
|
||||
}
|
||||
|
Reference in New Issue
Block a user