feat: add example scripts for argparse, bytes, dataset, html, markdown, uuid, wdantic, and web chat modules
Add comprehensive demo scripts showcasing the usage of multiple Wren modules including argument parsing, byte manipulation, in-memory dataset operations, HTML encoding/slugification, markdown-to-HTML conversion, UUID generation/validation, schema validation with wdantic, and a full web chat application with REST endpoints.
This commit is contained in:
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "web" for Router
|
||||
|
||||
var router = Router.new()
|
||||
router.get("/", Fn.new { |r| "home" })
|
||||
router.get("/users/:id", Fn.new { |r| "user" })
|
||||
router.post("/api/data", Fn.new { |r| "data" })
|
||||
|
||||
var m1 = router.match("GET", "/")
|
||||
System.print(m1 != null) // expect: true
|
||||
|
||||
var m2 = router.match("GET", "/users/123")
|
||||
System.print(m2 != null) // expect: true
|
||||
System.print(m2["params"]["id"]) // expect: 123
|
||||
|
||||
var m3 = router.match("POST", "/api/data")
|
||||
System.print(m3 != null) // expect: true
|
||||
|
||||
var m4 = router.match("GET", "/notfound")
|
||||
System.print(m4 == null) // expect: true
|
||||
Reference in New Issue
Block a user