From 17861000529f8496f7dfb765c7bd16ba26294263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20P=C3=A9rez?= Date: Tue, 28 Jan 2025 19:57:14 +0100 Subject: [PATCH] core updated --- core/.env.example | 14 +++++++++++++- core/cmd/main.go | 4 ++++ core/go.mod | 5 ++++- core/go.sum | 10 ++++++++-- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/core/.env.example b/core/.env.example index 1af2e7b..3e8fb40 100644 --- a/core/.env.example +++ b/core/.env.example @@ -2,4 +2,16 @@ DRIVERNAME=pgx MIGRATE=true DATASOURCE=postgresql://developer:secret@localhost:5432/db?sslmode=disable ASYMMETRICKEY= -DURATION= \ No newline at end of file +DURATION= + +# scraper +TITLE_SELECTOR= +SEASON_SELECTOR= +EPISODE_CARD_SELECTOR= +SEASON_EPISODE_AND_TITLE_SELECTOR= +RELEASED_DATE_SELECTOR= +PLOT_SELECTOR= +STAR_RATING_SELECTOR= +VOTE_COUNT_SELECTOR= +IMDB_EPISODES_URL= +VISIT_URL= \ No newline at end of file diff --git a/core/cmd/main.go b/core/cmd/main.go index 3ba4311..3d50673 100644 --- a/core/cmd/main.go +++ b/core/cmd/main.go @@ -7,6 +7,7 @@ import ( "log/slog" "github.com/gofiber/fiber/v2" + "github.com/gofiber/template/html/v2" "github.com/zepyrshut/rating-orama/internal/app" "github.com/zepyrshut/rating-orama/internal/handlers" "github.com/zepyrshut/rating-orama/internal/repository" @@ -23,10 +24,13 @@ func init() { var database embed.FS func main() { + engine := html.New("./views", ".html") + app := app.NewExtendedApp(appName, version, ".env") app.Migrate(database) f := fiber.New(fiber.Config{ AppName: appName, + Views: engine, }) pgxPool := db.NewPGXPool(app.Database.DataSource) diff --git a/core/go.mod b/core/go.mod index ebb8181..8b0ef9a 100644 --- a/core/go.mod +++ b/core/go.mod @@ -1,6 +1,6 @@ module github.com/zepyrshut/rating-orama -go 1.23.2 +go 1.23.5 require ( github.com/PuerkitoBio/goquery v1.10.0 @@ -18,6 +18,8 @@ require ( github.com/antchfx/xpath v1.3.2 // indirect github.com/go-sql-driver/mysql v1.5.0 // indirect github.com/gobwas/glob v0.2.3 // indirect + github.com/gofiber/template v1.8.3 // indirect + github.com/gofiber/utils v1.1.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/google/go-cmp v0.6.0 // indirect @@ -45,6 +47,7 @@ require ( require ( github.com/gocolly/colly v1.2.0 + github.com/gofiber/template/html/v2 v2.1.3 github.com/golang-migrate/migrate/v4 v4.18.1 // indirect github.com/jackc/chunkreader/v2 v2.0.1 // indirect github.com/jackc/pgio v1.0.0 // indirect diff --git a/core/go.sum b/core/go.sum index cfd7155..eba503d 100644 --- a/core/go.sum +++ b/core/go.sum @@ -45,6 +45,12 @@ github.com/gocolly/colly v1.2.0 h1:qRz9YAn8FIH0qzgNUw+HT9UN7wm1oF9OBAilwEWpyrI= github.com/gocolly/colly v1.2.0/go.mod h1:Hof5T3ZswNVsOHYmba1u03W65HDWgpV5HifSuueE0EA= github.com/gofiber/fiber/v2 v2.52.5 h1:tWoP1MJQjGEe4GB5TUGOi7P2E0ZMMRx5ZTG4rT+yGMo= github.com/gofiber/fiber/v2 v2.52.5/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ= +github.com/gofiber/template v1.8.3 h1:hzHdvMwMo/T2kouz2pPCA0zGiLCeMnoGsQZBTSYgZxc= +github.com/gofiber/template v1.8.3/go.mod h1:bs/2n0pSNPOkRa5VJ8zTIvedcI/lEYxzV3+YPXdBvq8= +github.com/gofiber/template/html/v2 v2.1.3 h1:n1LYBtmr9C0V/k/3qBblXyMxV5B0o/gpb6dFLp8ea+o= +github.com/gofiber/template/html/v2 v2.1.3/go.mod h1:U5Fxgc5KpyujU9OqKzy6Kn6Qup6Tm7zdsISR+VpnHRE= +github.com/gofiber/utils v1.1.0 h1:vdEBpn7AzIUJRhe+CiTOJdUcTg4Q9RK+pEa0KPbLdrM= +github.com/gofiber/utils v1.1.0/go.mod h1:poZpsnhBykfnY1Mc0KeEa6mSHrS3dV0+oBWyeQmb2e0= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-migrate/migrate/v4 v4.18.1 h1:JML/k+t4tpHCpQTCAD62Nu43NUFzHY4CV3uAuvHGC+Y= @@ -119,8 +125,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/temoto/robotstxt v1.1.2 h1:W2pOjSJ6SWvldyEuiFXNxz3xZ8aiWX5LbfDiOFd7Fxg= github.com/temoto/robotstxt v1.1.2/go.mod h1:+1AmkuG3IYkh1kv0d2qEB9Le88ehNO0zwOr3ujewlOo= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=