feat: add merge_all_wren utility, strutil demo, and 7 new API manual pages
Add WrenFileReader class in apps/merge_all_wren.wren for recursive .wren file discovery and content printing. Introduce example/strutil_demo.wren demonstrating case conversion, hex encoding, SHA256 hashing, string repetition, padding, HTML/JSON escaping, and URL encoding/decoding. Create manual/api pages for argparse, dataset, html, markdown, uuid, wdantic, and web modules. Update manual/api/index.html sidebar and module count from 21 to 28, adding links and cards for the new modules.
This commit is contained in:
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "web" for Router
|
||||
|
||||
var router = Router.new()
|
||||
|
||||
router.get("/api/v1/*", Fn.new { |r| "wildcard" })
|
||||
router.put("/users/:id", Fn.new { |r| "put user" })
|
||||
router.delete("/users/:id", Fn.new { |r| "delete user" })
|
||||
router.patch("/users/:id", Fn.new { |r| "patch user" })
|
||||
router.post("/users", Fn.new { |r| "create user" })
|
||||
|
||||
var m1 = router.match("GET", "/api/v1/anything")
|
||||
System.print(m1 != null) // expect: true
|
||||
|
||||
var m2 = router.match("GET", "/api/v1/nested/path")
|
||||
System.print(m2 != null) // expect: true
|
||||
|
||||
var m3 = router.match("PUT", "/users/456")
|
||||
System.print(m3 != null) // expect: true
|
||||
System.print(m3["params"]["id"]) // expect: 456
|
||||
|
||||
var m4 = router.match("DELETE", "/users/789")
|
||||
System.print(m4 != null) // expect: true
|
||||
System.print(m4["params"]["id"]) // expect: 789
|
||||
|
||||
var m5 = router.match("PATCH", "/users/101")
|
||||
System.print(m5 != null) // expect: true
|
||||
|
||||
var m6 = router.match("POST", "/users")
|
||||
System.print(m6 != null) // expect: true
|
||||
|
||||
var m7 = router.match("OPTIONS", "/users")
|
||||
System.print(m7 == null) // expect: true
|
||||
|
||||
var router2 = Router.new()
|
||||
router2.get("/posts/:postId/comments/:commentId", Fn.new { |r| "comment" })
|
||||
|
||||
var m8 = router2.match("GET", "/posts/10/comments/20")
|
||||
System.print(m8 != null) // expect: true
|
||||
System.print(m8["params"]["postId"]) // expect: 10
|
||||
System.print(m8["params"]["commentId"]) // expect: 20
|
||||
Reference in New Issue
Block a user