feat: add HTTP framework with routing and JSON helpers

- Add stdlib/http.lux with:
  - Response builders (httpOk, httpNotFound, etc.)
  - Path pattern matching with parameter extraction
  - JSON construction helpers (jsonStr, jsonNum, jsonObj, etc.)
- Add examples/http_api.lux demonstrating a complete REST API
- Add examples/http_router.lux showing the routing pattern
- Update stdlib/lib.lux to include http module

The framework provides functional building blocks for web apps:
- Route matching: pathMatches("/users/:id", path)
- Path params: getPathSegment(path, 1)
- Response building: httpOk(jsonObj(...))

Note: Due to current type system limitations with type aliases
and function types, the framework uses inline types rather
than abstract Request/Response types.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-16 04:21:57 -05:00
parent 3a46299404
commit 204950357f
4 changed files with 438 additions and 1 deletions

View File

@@ -3,6 +3,7 @@
// This module re-exports the core standard library modules.
// Import with: import stdlib
// Re-export Html module
// Re-export core modules
pub import html
pub import browser
pub import http