Switched to vestigo router

Also moved db reference to data module; it now starts, but doesn't serve index.html for root yet
This commit is contained in:
Daniel J. Summers
2018-03-22 22:11:38 -05:00
parent b248f7ca7f
commit 59b5574b16
5 changed files with 43 additions and 52 deletions

View File

@@ -39,10 +39,10 @@ func readSettings(f string) *Settings {
func main() {
cfg := readSettings("config.json")
db, ok := data.Connect(cfg.Data)
if !ok {
if ok := data.Connect(cfg.Data); !ok {
log.Fatal("Unable to connect to database; exiting")
}
data.EnsureDB()
log.Printf("myPrayerJournal API listening on %s", cfg.Web.Port)
log.Fatal(http.ListenAndServe(cfg.Web.Port, routes.NewRouter(db, cfg.Auth)))
log.Fatal(http.ListenAndServe(cfg.Web.Port, routes.NewRouter(cfg.Auth)))
}