From f0ada28815f35f160f0e85101728d215c0f7d7f9 Mon Sep 17 00:00:00 2001 From: polwex Date: Fri, 27 Jun 2025 08:24:37 +0700 Subject: m --- CLAUDE.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'CLAUDE.md') diff --git a/CLAUDE.md b/CLAUDE.md index b849fa7..8c6cf38 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,15 +1,23 @@ -# OCaml Routes Library DSL +# OCaml SSR React APP on Eio -## The `@-->` Operator +This app is a WIP to implement a blog as a React webapp (using reason-react) using Ocaml, Piaf for HTTP handling, Caqti to handle database queries, using Eio across the app for async. + + + +## Things to take into account + +### Ocaml Routes library + +#### The `@-->` Operator The `@-->` operator is from the `routes` library and is used to bind route patterns to handler functions. -### Example: +##### Example: ```ocaml `GET, (s "posts" /? nil) @--> Handler.get_posts ``` -### Breaking it down: +##### Breaking it down: - `s "posts"` - matches the string "posts" in the URL path - `/?` - path concatenation operator - `nil` - end of path (no more segments) @@ -17,9 +25,9 @@ The `@-->` operator is from the `routes` library and is used to bind route patte 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: +##### 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 +It's a DSL (domain-specific language) for expressing routes in a concise, type-safe way. -- cgit v1.2.3