docs: add verified package usage examples

This commit is contained in:
2026-07-13 20:51:04 +05:30
parent 7a1c6c0041
commit 4ce087b238
67 changed files with 592 additions and 136 deletions
+6 -4
View File
@@ -6,7 +6,9 @@ with one function call, drop a drag-and-drop widget on a page, and serve files b
private. Zero external dependencies (S3 is signed with a built-in AWS SigV4 implementation, like the
rest of the framework).
## Configure
## Usage
### Configure local and S3 stores
```ts
// wrnexus.config.ts
@@ -40,7 +42,7 @@ const config: AppConfig = {
export default config;
```
## Upload (server)
### Upload from an API route or server function
```ts
// app/api/upload.ts — one-liner
@@ -60,7 +62,7 @@ Uploads are validated (size + type), stored under a random, collision-proof, pat
(the client filename is never used as a path), and — for public stores — returned with a servable
`url`.
## Widget (client)
### Add a client upload widget
Drop the element anywhere; the runtime (drag-and-drop, per-file progress, success/failed states) is
auto-injected on pages that contain `data-uploader`:
@@ -92,7 +94,7 @@ It dispatches bubbling events you can listen for:
- `wrnexus:upload``detail: { file, result: { key, url, name, size, type } }`
- `wrnexus:upload-error``detail: { file, error }`
## Serve files
### Serve private files behind application authentication
- **Public + local** → served automatically at `/__wrnexus/uploads/<store>/<key>` (immutable cache).
- **Public + S3** → `url` is the bucket/CDN URL directly.