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"
|
2023-11-24 14:27:23 -05:00
|
|
|
"github.com/flamego/template"
|
|
|
|
|
2023-11-27 22:36:58 -05:00
|
|
|
"git.metaunix.net/bitgoblin/blt/models"
|
2023-11-24 14:27:23 -05:00
|
|
|
"git.metaunix.net/bitgoblin/blt/web"
|
|
|
|
"git.metaunix.net/bitgoblin/blt/web/middleware"
|
2023-11-23 19:01:17 -05:00
|
|
|
)
|
|
|
|
|
2023-11-24 14:27:23 -05:00
|
|
|
var Version string = "N/a"
|
|
|
|
|
2023-11-23 19:01:17 -05:00
|
|
|
func main() {
|
2023-11-24 14:27:23 -05:00
|
|
|
// 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
|
2023-11-28 14:40:12 -05:00
|
|
|
models.Open()
|
2023-11-27 22:36:58 -05:00
|
|
|
|
2023-11-24 14:27:23 -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
|
|
|
|
2023-11-24 14:27:23 -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
|
|
|
}
|