summaryrefslogtreecommitdiff
path: root/CLAUDE.md
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-06-23 06:02:52 +0700
committerpolwex <polwex@sortug.com>2025-06-23 06:02:52 +0700
commitf4459658a0cad4b7615c01af9c3f87fb4d0233e0 (patch)
treea5f2403e420154abd95dffdc6c45045c8530599a /CLAUDE.md
parentd653f488017b1904fb0089d2bf308ae042240f38 (diff)
working working
Diffstat (limited to 'CLAUDE.md')
-rw-r--r--CLAUDE.md25
1 files changed, 25 insertions, 0 deletions
diff --git a/CLAUDE.md b/CLAUDE.md
new file mode 100644
index 0000000..b849fa7
--- /dev/null
+++ b/CLAUDE.md
@@ -0,0 +1,25 @@
+# OCaml Routes Library DSL
+
+## The `@-->` Operator
+
+The `@-->` operator is from the `routes` library and is used to bind route patterns to handler functions.
+
+### Example:
+```ocaml
+`GET, (s "posts" /? nil) @--> Handler.get_posts
+```
+
+### Breaking it down:
+- `s "posts"` - matches the string "posts" in the URL path
+- `/?` - path concatenation operator
+- `nil` - end of path (no more segments)
+- `@-->` - "maps to" operator that binds the route to the handler
+
+So `(s "posts" /? nil) @--> Handler.get_posts` means "the route `/posts` maps to the `Handler.get_posts` function".
+
+### Other common operators in the routes library:
+- `/:` for path parameters (e.g., `s "user" /: int /? nil` matches `/user/123`)
+- `//` for wildcard paths
+- `<$>` for transforming matched values
+
+It's a DSL (domain-specific language) for expressing routes in a concise, type-safe way. \ No newline at end of file