diff options
Diffstat (limited to 'routes')
-rw-r--r-- | routes/routes.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/routes/routes.go b/routes/routes.go index a960277..a609019 100644 --- a/routes/routes.go +++ b/routes/routes.go @@ -3,19 +3,28 @@ package routes import ( "git.sr.ht/~gabrielgio/midr/controller" "git.sr.ht/~gabrielgio/midr/db" + "git.sr.ht/~gabrielgio/midr/worker" "github.com/gin-gonic/gin" ) func HandleRequests() { + models := db.EntryModel{DB: db.DB} + worker := worker.Worker{} + + worker.StartWorker(models) + env := &controller.Env{ - Entries: db.EntryModel{DB: db.DB}, + Entries: models, + Worker: worker, } r := gin.Default() r.LoadHTMLGlob("templates/*") + r.Static("/assets", "./assets") r.GET("/", env.GetEntries) - r.GET("entries/", env.GetEntry) + r.GET("/entries/", env.GetEntries) + r.GET("entries/createEntry", env.GetEntry) r.POST("entries/", env.CreateEntry) r.GET("entries/:id", env.GetEntry) r.POST("entries/:id", env.UpdateEntry) |