blt/main.go

37 lines
727 B
Go
Raw Normal View History

2023-11-23 19:01:17 -05:00
package main
import (
2023-11-24 13:25:24 -05:00
"log"
"net/http"
"github.com/flamego/flamego"
"github.com/flamego/template"
2023-11-27 22:36:58 -05:00
"git.metaunix.net/bitgoblin/blt/models"
"git.metaunix.net/bitgoblin/blt/web"
"git.metaunix.net/bitgoblin/blt/web/middleware"
2023-11-23 19:01:17 -05:00
)
var Version string = "N/a"
2023-11-23 19:01:17 -05:00
func main() {
// initial Flamego server object
2023-11-23 19:01:17 -05:00
f := flamego.Classic()
2023-11-27 22:36:58 -05:00
// initialize database
models.Open()
2023-11-27 22:36:58 -05:00
// 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)
2023-11-23 19:01:17 -05:00
// alert the user and start the server
2023-11-24 13:25:24 -05:00
log.Println("Server is running...")
log.Println(http.ListenAndServe("0.0.0.0:2830", f))
2023-11-23 19:01:17 -05:00
}