Add dataloaders to combine database queries (#190)

See also https://gqlgen.com/reference/dataloaders/
This commit is contained in:
Viktor Strate Kløvedal
2021-02-07 22:17:33 +01:00
committed by GitHub
parent 54a83a4dc6
commit ce3090394b
13 changed files with 931 additions and 80 deletions

View File

@@ -12,6 +12,7 @@ import (
"github.com/photoview/photoview/api/database"
"github.com/photoview/photoview/api/graphql/auth"
"github.com/photoview/photoview/api/graphql/dataloader"
"github.com/photoview/photoview/api/routes"
"github.com/photoview/photoview/api/scanner"
"github.com/photoview/photoview/api/server"
@@ -52,6 +53,7 @@ func main() {
rootRouter := mux.NewRouter()
rootRouter.Use(dataloader.Middleware(db))
rootRouter.Use(auth.Middleware(db))
rootRouter.Use(server.LoggingMiddleware)
rootRouter.Use(server.CORSMiddleware(devMode))