summaryrefslogtreecommitdiff
path: root/processors
diff options
context:
space:
mode:
Diffstat (limited to 'processors')
-rw-r--r--processors/metadata.go17
-rw-r--r--processors/processors.go8
-rw-r--r--processors/request.go12
3 files changed, 37 insertions, 0 deletions
diff --git a/processors/metadata.go b/processors/metadata.go
new file mode 100644
index 0000000..9f2fbfb
--- /dev/null
+++ b/processors/metadata.go
@@ -0,0 +1,17 @@
+package processors
+
+import (
+ "cafe/config"
+
+ "github.com/gofiber/fiber/v2"
+)
+
+const defaultTitle = "Shifoo's Cafe"
+
+func metadata(ctx *fiber.Ctx) error {
+ ctx.Locals("Title", defaultTitle)
+ ctx.Locals("AppName", config.Server.AppName)
+ ctx.Locals("AppDescription", config.Server.AppDescription)
+
+ return ctx.Next()
+}
diff --git a/processors/processors.go b/processors/processors.go
new file mode 100644
index 0000000..d56cbde
--- /dev/null
+++ b/processors/processors.go
@@ -0,0 +1,8 @@
+package processors
+
+import "github.com/gofiber/fiber/v2"
+
+func Initialize(app *fiber.App) {
+ app.Use(metadata)
+ app.Use(request)
+}
diff --git a/processors/request.go b/processors/request.go
new file mode 100644
index 0000000..f63a3dc
--- /dev/null
+++ b/processors/request.go
@@ -0,0 +1,12 @@
+package processors
+
+import (
+ "cafe/utils/meta"
+
+ "github.com/gofiber/fiber/v2"
+)
+
+func request(ctx *fiber.Ctx) error {
+ ctx.Locals("Request", meta.BuildRequest(ctx))
+ return ctx.Next()
+}