aboutsummaryrefslogtreecommitdiff
path: root/cmd/galleryd
diff options
context:
space:
mode:
authorSaiyed Shizain <saiyedshizain@gmail.com>2026-07-13 17:39:59 +0530
committerGitHub <noreply@github.com>2026-07-13 17:39:59 +0530
commitae29fa5ee155bb4828ea6eb8b164a30f7ec9fae8 (patch)
tree4fbbce3d746c22a4cbb42ec53a9abd3e698bc67b /cmd/galleryd
parentcc639337ed5ccb4634b2a338f764cf9c73b02e4f (diff)
parent56bb199787f8fc80b92779426644250f2709fd36 (diff)
downloadgalleryd-ae29fa5ee155bb4828ea6eb8b164a30f7ec9fae8.tar.xz
galleryd-ae29fa5ee155bb4828ea6eb8b164a30f7ec9fae8.zip
Merge pull request #6 from RanXom/feat/api
Feat/api: implement HTTP server and expose required endpoints
Diffstat (limited to 'cmd/galleryd')
-rw-r--r--cmd/galleryd/main.go50
1 files changed, 50 insertions, 0 deletions
diff --git a/cmd/galleryd/main.go b/cmd/galleryd/main.go
new file mode 100644
index 0000000..e23f8a2
--- /dev/null
+++ b/cmd/galleryd/main.go
@@ -0,0 +1,50 @@
+package main
+
+import (
+ "context"
+ "log"
+ "os"
+ "os/signal"
+ "syscall"
+
+ "github.com/RanXom/galleryd/internal/api"
+ "github.com/RanXom/galleryd/internal/gallery"
+ "github.com/RanXom/galleryd/internal/metadata"
+ "github.com/RanXom/galleryd/internal/scanner"
+ "github.com/RanXom/galleryd/internal/service"
+)
+
+func main() {
+ ctx, stop := signal.NotifyContext(
+ context.Background(),
+ os.Interrupt,
+ syscall.SIGTERM,
+ )
+ defer stop()
+
+ scanner := scanner.New(scanner.Config{
+ Roots: []string{
+ "/home/ranxom/Pictures",
+ },
+ })
+
+ reader := metadata.New()
+
+ builder := gallery.New(reader)
+
+ gallerySerice := service.New(
+ scanner,
+ builder,
+ )
+
+ server := api.New(api.Config{
+ Address: ":8082",
+ Gallery: gallerySerice,
+ })
+
+ log.Println("galleryd listening on :8082")
+
+ if err := server.Run(ctx); err != nil {
+ log.Fatal(err)
+ }
+}