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
+19
@@ -0,0 +1,19 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "web" for Response
|
||||
|
||||
var r1 = Response.text("Hello")
|
||||
System.print(r1.body) // expect: Hello
|
||||
System.print(r1.headers["Content-Type"].contains("text/plain")) // expect: true
|
||||
|
||||
var r2 = Response.html("<h1>Hi</h1>")
|
||||
System.print(r2.body) // expect: <h1>Hi</h1>
|
||||
System.print(r2.headers["Content-Type"].contains("text/html")) // expect: true
|
||||
|
||||
var r3 = Response.json({"name": "test"})
|
||||
System.print(r3.body.contains("name")) // expect: true
|
||||
System.print(r3.headers["Content-Type"].contains("application/json")) // expect: true
|
||||
|
||||
var r4 = Response.redirect("/login")
|
||||
System.print(r4.status) // expect: 302
|
||||
System.print(r4.headers["Location"]) // expect: /login
|
||||
Reference in New Issue
Block a user