@pureq/pureq 1.1.7 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# pureq
|
|
2
|
+
|
|
3
|
+
Functional, immutable, and type-safe HTTP transport layer for TypeScript.
|
|
4
|
+
|
|
5
|
+
[Getting Started](./docs/getting_started.md) | [Documentation](./docs/README.md) | [Middleware Reference](./docs/middleware_reference.md) | [GitHub](https://github.com/shiro-shihi/pureq)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
pureq is a policy-first transport layer that makes HTTP behavior explicit, composable, and observable across frontend, BFF, backend, and edge runtimes.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { createClient, retry, circuitBreaker, dedupe } from "@pureq/pureq";
|
|
13
|
+
|
|
14
|
+
const api = createClient({ baseURL: "https://api.example.com" })
|
|
15
|
+
.use(dedupe())
|
|
16
|
+
.use(retry({ maxRetries: 2, delay: 200 }))
|
|
17
|
+
.use(circuitBreaker({ failureThreshold: 5, cooldownMs: 30_000 }));
|
|
18
|
+
|
|
19
|
+
const user = await api.getJson<User>("/users/:id", { params: { id: "42" } });
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Highlights
|
|
23
|
+
|
|
24
|
+
- Immutable client composition
|
|
25
|
+
- Onion model middleware
|
|
26
|
+
- Typed path params
|
|
27
|
+
- Result-based error handling
|
|
28
|
+
- No runtime dependencies
|
|
29
|
+
- Works in Node, browser, and edge runtimes
|
|
30
|
+
|
|
31
|
+
## Documentation
|
|
32
|
+
|
|
33
|
+
- [Getting Started](./docs/getting_started.md)
|
|
34
|
+
- [Core Concepts](./docs/core_concepts.md)
|
|
35
|
+
- [API Reference](./docs/api_reference.md)
|
|
36
|
+
- [Middleware Reference](./docs/middleware_reference.md)
|
|
37
|
+
- [Error Handling](./docs/error_handling.md)
|
|
38
|
+
- [Observability](./docs/observability.md)
|
|
39
|
+
- [Migration Guide](./docs/migration_guide.md)
|
|
40
|
+
- [Benchmarks](./docs/benchmarks.md)
|
|
41
|
+
|
|
42
|
+
## License
|
|
43
|
+
|
|
44
|
+
MIT
|
package/package.json
CHANGED