@wooksjs/event-http 0.6.6 → 0.7.0
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 +11 -45
- package/dist/index.cjs +1143 -963
- package/dist/index.d.ts +359 -303
- package/dist/index.mjs +1101 -917
- package/package.json +7 -7
- package/skills/wooksjs-event-http/SKILL.md +28 -21
- package/skills/wooksjs-event-http/core.md +83 -228
- package/skills/wooksjs-event-http/request.md +130 -146
- package/skills/wooksjs-event-http/response.md +166 -235
- package/skills/wooksjs-event-http/testing.md +150 -0
- package/skills/wooksjs-event-http/addons.md +0 -307
- package/skills/wooksjs-event-http/error-handling.md +0 -253
- package/skills/wooksjs-event-http/event-core.md +0 -562
- package/skills/wooksjs-event-http/routing.md +0 -412
package/README.md
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# @wooksjs/event-http
|
|
2
2
|
|
|
3
|
-
**!!! This is work-in-progress library, breaking changes are expected !!!**
|
|
4
|
-
|
|
5
3
|
<p align="center">
|
|
6
4
|
<img src="../../wooks-logo.png" width="450px"><br>
|
|
7
5
|
<a href="https://github.com/wooksjs/wooksjs/blob/main/LICENSE">
|
|
@@ -9,47 +7,17 @@
|
|
|
9
7
|
</a>
|
|
10
8
|
</p>
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
- parse urls search params
|
|
15
|
-
- parse cookies
|
|
16
|
-
- parse request body (json, url-encoded, form, ...)
|
|
17
|
-
- serve files
|
|
18
|
-
|
|
19
|
-
### The main ideas behind composable functions are:
|
|
20
|
-
|
|
21
|
-
1. Never mutate request object (`req`). Accumulate a request context in a separate object(s) instead (`wooks store`);
|
|
22
|
-
2. Never parse anything (cookies, body) before it is really requested by the request handler;
|
|
23
|
-
3. Get rid of complex predefined data objects containing everything (cookies, headers, body, parsed body etc.) and use composable functions (hooks) instead;
|
|
24
|
-
4. Get rid of tons of dependencies (middlewares) and implement everything that is needed for web app in a simple way.
|
|
25
|
-
|
|
26
|
-
### Official Wooks HTTP composables:
|
|
27
|
-
|
|
28
|
-
- [@wooksjs/http-body](https://github.com/wooksjs/wooksjs/tree/main/packages/http-body) - to parse body
|
|
29
|
-
- [@wooksjs/http-static](https://github.com/wooksjs/wooksjs/tree/main/packages/http-static) - to serve static files
|
|
30
|
-
- [@wooksjs/http-proxy](https://github.com/wooksjs/wooksjs/tree/main/packages/http-proxy) - to proxy requests
|
|
10
|
+
HTTP event processing for the Wooks framework. Provides composables for request parsing, response management, cookies, headers, caching, and more — all lazily computed and cached per event.
|
|
31
11
|
|
|
32
12
|
## Installation
|
|
33
13
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
import { useRouteParams } from 'wooks'
|
|
40
|
-
import { createHttpApp } from '@wooksjs/event-http'
|
|
41
|
-
|
|
42
|
-
const app = createHttpApp()
|
|
14
|
+
```sh
|
|
15
|
+
npm install @wooksjs/event-http
|
|
16
|
+
```
|
|
43
17
|
|
|
44
|
-
|
|
18
|
+
## Documentation
|
|
45
19
|
|
|
46
|
-
|
|
47
|
-
// app.get('hello/:name', () => `Hello ${ useRouteParams().get('name') }!`)
|
|
48
|
-
|
|
49
|
-
app.listen(3000, () => {
|
|
50
|
-
console.log('Wooks Server is up on port 3000')
|
|
51
|
-
})
|
|
52
|
-
```
|
|
20
|
+
For full documentation, visit [wooks.moost.org/webapp](https://wooks.moost.org/webapp/).
|
|
53
21
|
|
|
54
22
|
## AI Agent Skills
|
|
55
23
|
|
|
@@ -57,10 +25,10 @@ This package ships with structured skill files for AI coding agents (Claude Code
|
|
|
57
25
|
|
|
58
26
|
```bash
|
|
59
27
|
# Project-local (recommended — version-locked, commits with your repo)
|
|
60
|
-
npx
|
|
28
|
+
npx wooksjs-event-http-skill
|
|
61
29
|
|
|
62
30
|
# Global (available across all your projects)
|
|
63
|
-
npx
|
|
31
|
+
npx wooksjs-event-http-skill --global
|
|
64
32
|
```
|
|
65
33
|
|
|
66
34
|
To keep skills automatically up-to-date, add a postinstall script to your `package.json`:
|
|
@@ -68,13 +36,11 @@ To keep skills automatically up-to-date, add a postinstall script to your `packa
|
|
|
68
36
|
```json
|
|
69
37
|
{
|
|
70
38
|
"scripts": {
|
|
71
|
-
"postinstall": "
|
|
39
|
+
"postinstall": "wooksjs-event-http-skill --postinstall"
|
|
72
40
|
}
|
|
73
41
|
}
|
|
74
42
|
```
|
|
75
43
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
## Documentation
|
|
44
|
+
## License
|
|
79
45
|
|
|
80
|
-
|
|
46
|
+
MIT
|