@wnodex/body-parser 0.2.1 → 0.2.2
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/.turbo/turbo-build.log +2 -2
- package/README.md +70 -5
- package/package.json +10 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
> @wnodex/body-parser@0.2.
|
|
2
|
+
> @wnodex/body-parser@0.2.2 build /home/runner/work/wnodex/wnodex/packages/body-parser
|
|
3
3
|
> rolldown -c && tsc
|
|
4
4
|
|
|
5
5
|
[log] <DIR>/index.js chunk │ size: 1.13 kB
|
|
6
6
|
[log]
|
|
7
|
-
[success] rolldown v1.0.0-rc.1 Finished in
|
|
7
|
+
[success] rolldown v1.0.0-rc.1 Finished in 21.97 ms
|
package/README.md
CHANGED
|
@@ -1,14 +1,79 @@
|
|
|
1
1
|
# @wnodex/body-parser
|
|
2
2
|
|
|
3
|
-
wnodex body-parser middleware
|
|
3
|
+
> wnodex body-parser middleware
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Part of the [wnodex](https://github.com/wnodex/wnodex) ecosystem, this package provides body-parser middleware for `wnodex`.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## About
|
|
8
8
|
|
|
9
|
-
-
|
|
9
|
+
`@wnodex/body-parser` is a middleware for `wnodex` that integrates the `body-parser` library to handle JSON and URL-encoded request bodies. It allows you to configure body parsing behavior through the main `wnodex` configuration.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- Seamless integration with the `wnodex` server.
|
|
14
|
+
- Parses incoming request bodies in a middleware before your handlers.
|
|
15
|
+
- Supports both JSON and URL-encoded bodies.
|
|
16
|
+
- Configuration is centralized in the `wnodex` constructor.
|
|
17
|
+
- Based on the widely-used `body-parser` library.
|
|
18
|
+
|
|
19
|
+
## Why use it?
|
|
20
|
+
|
|
21
|
+
This package simplifies request body parsing in your `wnodex` application. By integrating with the `wnodex` configuration system, it provides a consistent and streamlined way to manage middleware settings, abstracting away the boilerplate of setting up `body-parser` manually.
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
You can install the package using your favorite package manager:
|
|
26
|
+
|
|
27
|
+
**pnpm**
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pnpm add @wnodex/body-parser
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**npm**
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install @wnodex/body-parser
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**yarn**
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
yarn add @wnodex/body-parser
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**bun**
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
bun add @wnodex/body-parser
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Usage
|
|
52
|
+
|
|
53
|
+
`@wnodex/body-parser` is enabled by default in `wnodex`. You can customize its behavior by passing a `bodyParsers` object to the `Wnodex` constructor.
|
|
54
|
+
|
|
55
|
+
To disable it, set `bodyParsers` to `false`.
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
import { Wnodex } from 'wnodex';
|
|
59
|
+
|
|
60
|
+
// Example: Enable with custom options
|
|
61
|
+
const server = new Wnodex({
|
|
62
|
+
bodyParsers: {
|
|
63
|
+
json: { limit: '10mb' },
|
|
64
|
+
urlencoded: { extended: true },
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Example: Disable body-parser
|
|
69
|
+
const serverWithDisabledBodyParser = new Wnodex({
|
|
70
|
+
bodyParsers: false,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
server.start();
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The options for `json` and `urlencoded` are passed directly to the `body-parser` library.
|
|
12
77
|
|
|
13
78
|
## License
|
|
14
79
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wnodex/body-parser",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"private": false,
|
|
5
|
-
"description": "wnodex body-parser
|
|
5
|
+
"description": "A wnodex middleware that integrates body-parser to handle JSON and URL-encoded request bodies.",
|
|
6
6
|
"keywords": [
|
|
7
|
-
"wnodex"
|
|
7
|
+
"wnodex",
|
|
8
|
+
"middleware",
|
|
9
|
+
"body-parser",
|
|
10
|
+
"express",
|
|
11
|
+
"json",
|
|
12
|
+
"urlencoded",
|
|
13
|
+
"parser"
|
|
8
14
|
],
|
|
9
15
|
"homepage": "https://github.com/wnodex/wnodex#readme",
|
|
10
16
|
"bugs": {
|
|
@@ -39,7 +45,7 @@
|
|
|
39
45
|
"@types/node": "^25.0.10",
|
|
40
46
|
"rolldown": "1.0.0-rc.1",
|
|
41
47
|
"typescript": "5.9.2",
|
|
42
|
-
"@wnodex/typescript-config": "0.2.
|
|
48
|
+
"@wnodex/typescript-config": "0.2.2"
|
|
43
49
|
},
|
|
44
50
|
"publishConfig": {
|
|
45
51
|
"access": "public"
|