wnodex 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 +96 -4
- package/package.json +24 -15
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
> wnodex@0.2.
|
|
2
|
+
> wnodex@0.2.2 build /home/runner/work/wnodex/wnodex/packages/wnodex
|
|
3
3
|
> rolldown -c && tsc
|
|
4
4
|
|
|
5
5
|
[log] <DIR>/index.js chunk │ size: 5.08 kB
|
|
6
6
|
[log]
|
|
7
|
-
[success] rolldown v1.0.0-rc.1 Finished in
|
|
7
|
+
[success] rolldown v1.0.0-rc.1 Finished in 4.84 ms
|
package/README.md
CHANGED
|
@@ -1,12 +1,104 @@
|
|
|
1
1
|
# wnodex
|
|
2
2
|
|
|
3
|
-
Web Node Express: an extensible and robust express.js server class designed for effortless customization and rapid deployment
|
|
3
|
+
> Web Node Express: an extensible and robust express.js server class designed for effortless customization and rapid deployment.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`wnodex` is a TypeScript-first framework that wraps Express.js to provide a modern, configuration-driven, and extensible foundation for building Node.js web servers. It comes with a suite of integrated middlewares for common tasks like security, body parsing, and logging, all manageable from a single configuration object.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Features
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
- **Configuration-Driven**: Centralize your server setup in one object.
|
|
10
|
+
- **TypeScript First**: Written entirely in TypeScript for a great developer experience.
|
|
11
|
+
- **Extensible**: Composed of modular packages that can be used independently.
|
|
12
|
+
- **Sensible Defaults**: Pre-configured with best practices for security and performance.
|
|
13
|
+
- **Graceful Shutdown**: Built-in support for safely stopping the server.
|
|
14
|
+
- **Integrated Tooling**: Includes middlewares for:
|
|
15
|
+
- Security headers (`@wnodex/helmet`)
|
|
16
|
+
- Cross-Origin Resource Sharing (`@wnodex/cors`)
|
|
17
|
+
- Body and cookie parsing (`@wnodex/body-parser`, `@wnodex/cookie-parser`)
|
|
18
|
+
- Response compression (`@wnodex/compression`)
|
|
19
|
+
- Rate limiting (`@wnodex/rate-limit`)
|
|
20
|
+
- Parameter pollution protection (`@wnodex/hpp`)
|
|
21
|
+
- Session management (`@wnodex/session`)
|
|
22
|
+
- Authentication (`@wnodex/passport`)
|
|
23
|
+
- Structured logging (`@wnodex/logger`)
|
|
24
|
+
- Centralized error handling (`@wnodex/errors`)
|
|
25
|
+
|
|
26
|
+
## Why use it?
|
|
27
|
+
|
|
28
|
+
`wnodex` solves the problem of boilerplate and inconsistent configuration in Express.js applications. Instead of manually setting up and managing a dozen different middlewares, `wnodex` provides a cohesive ecosystem where everything is designed to work together. This leads to faster development, cleaner code, and more secure applications by default.
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
You can install the package using your favorite package manager:
|
|
33
|
+
|
|
34
|
+
**pnpm**
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pnpm add wnodex
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**npm**
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install wnodex
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**yarn**
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
yarn add wnodex
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**bun**
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
bun add wnodex
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Usage
|
|
59
|
+
|
|
60
|
+
Create a new `Wnodex` instance, passing your configuration to the constructor. Then, call the `start()` method.
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
import { Wnodex } from 'wnodex';
|
|
64
|
+
|
|
65
|
+
// 1. Create a server instance with your configuration
|
|
66
|
+
const server = new Wnodex({
|
|
67
|
+
port: process.env.PORT || 3000,
|
|
68
|
+
helmet: true,
|
|
69
|
+
cors: {
|
|
70
|
+
origin: 'https://my-app.com',
|
|
71
|
+
},
|
|
72
|
+
session: {
|
|
73
|
+
secret: 'my-session-secret',
|
|
74
|
+
resave: false,
|
|
75
|
+
saveUninitialized: false,
|
|
76
|
+
},
|
|
77
|
+
passport: true,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// 2. Get the underlying Express app to define routes
|
|
81
|
+
const app = server.getApp();
|
|
82
|
+
|
|
83
|
+
app.get('/', (req, res) => {
|
|
84
|
+
res.send('Hello from wnodex!');
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// 3. Start the server
|
|
88
|
+
server.start().catch((err) => {
|
|
89
|
+
const logger = server.getLogger();
|
|
90
|
+
logger.error(err, 'Failed to start server');
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// Handle graceful shutdown on OS signals
|
|
94
|
+
const gracefulShutdown = async () => {
|
|
95
|
+
await server.shutdown();
|
|
96
|
+
process.exit(0);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
process.on('SIGINT', gracefulShutdown);
|
|
100
|
+
process.on('SIGTERM', gracefulShutdown);
|
|
101
|
+
```
|
|
10
102
|
|
|
11
103
|
## License
|
|
12
104
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wnodex",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"private": false,
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "An extensible and robust Express.js server framework designed for effortless customization and rapid deployment with sensible defaults.",
|
|
6
6
|
"keywords": [
|
|
7
|
-
"wnodex"
|
|
7
|
+
"wnodex",
|
|
8
|
+
"express",
|
|
9
|
+
"framework",
|
|
10
|
+
"typescript",
|
|
11
|
+
"nodejs",
|
|
12
|
+
"server",
|
|
13
|
+
"http",
|
|
14
|
+
"web",
|
|
15
|
+
"security",
|
|
16
|
+
"middleware"
|
|
8
17
|
],
|
|
9
18
|
"homepage": "https://github.com/wnodex/wnodex#readme",
|
|
10
19
|
"bugs": {
|
|
@@ -42,17 +51,17 @@
|
|
|
42
51
|
"pino": "^10.3.0",
|
|
43
52
|
"pino-pretty": "^13.1.3",
|
|
44
53
|
"zod": "^4.3.6",
|
|
45
|
-
"@wnodex/
|
|
46
|
-
"@wnodex/
|
|
47
|
-
"@wnodex/
|
|
48
|
-
"@wnodex/
|
|
49
|
-
"@wnodex/
|
|
50
|
-
"@wnodex/
|
|
51
|
-
"@wnodex/passport": "0.2.
|
|
52
|
-
"@wnodex/
|
|
53
|
-
"@wnodex/
|
|
54
|
-
"@wnodex/session": "0.2.
|
|
55
|
-
"@wnodex/rate-limit": "0.2.
|
|
54
|
+
"@wnodex/body-parser": "0.2.2",
|
|
55
|
+
"@wnodex/cookie-parser": "0.2.2",
|
|
56
|
+
"@wnodex/cors": "0.2.2",
|
|
57
|
+
"@wnodex/errors": "0.2.2",
|
|
58
|
+
"@wnodex/hpp": "0.2.2",
|
|
59
|
+
"@wnodex/compression": "0.2.2",
|
|
60
|
+
"@wnodex/passport": "0.2.2",
|
|
61
|
+
"@wnodex/logger": "0.2.2",
|
|
62
|
+
"@wnodex/helmet": "0.2.2",
|
|
63
|
+
"@wnodex/session": "0.2.2",
|
|
64
|
+
"@wnodex/rate-limit": "0.2.2"
|
|
56
65
|
},
|
|
57
66
|
"devDependencies": {
|
|
58
67
|
"@types/compression": "^1.8.1",
|
|
@@ -68,7 +77,7 @@
|
|
|
68
77
|
"supertest": "^7.2.2",
|
|
69
78
|
"typescript": "5.9.2",
|
|
70
79
|
"vitest": "^4.0.18",
|
|
71
|
-
"@wnodex/typescript-config": "0.2.
|
|
80
|
+
"@wnodex/typescript-config": "0.2.2"
|
|
72
81
|
},
|
|
73
82
|
"publishConfig": {
|
|
74
83
|
"access": "public"
|