@wnodex/session 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.
@@ -1,7 +1,7 @@
1
1
 
2
- > @wnodex/session@0.2.1 build /home/runner/work/wnodex/wnodex/packages/session
2
+ > @wnodex/session@0.2.2 build /home/runner/work/wnodex/wnodex/packages/session
3
3
  > rolldown -c && tsc
4
4
 
5
5
  [log] <DIR>/index.js chunk │ size: 1.95 kB
6
6
  [log]
7
- [success] rolldown v1.0.0-rc.1 Finished in 25.93 ms
7
+ [success] rolldown v1.0.0-rc.1 Finished in 20.57 ms
package/README.md CHANGED
@@ -1,14 +1,78 @@
1
1
  # @wnodex/session
2
2
 
3
- wnodex session middleware
3
+ > wnodex session middleware
4
4
 
5
- ---
5
+ Part of the [wnodex](https://github.com/wnodex/wnodex) ecosystem, this package provides session management middleware.
6
6
 
7
- ## Table of Content
7
+ ## About
8
8
 
9
- - [License](#license)
9
+ `@wnodex/session` integrates `express-session` to create and manage user sessions in your `wnodex` application. It is a crucial component for tracking user state, especially for authentication.
10
10
 
11
- ---
11
+ ## Features
12
+
13
+ - Manages user sessions with cookies.
14
+ - Highly configurable, including cookie options, secret, and store.
15
+ - Seamlessly integrates with `@wnodex/passport`.
16
+ - Centralized configuration within the `Wnodex` constructor.
17
+
18
+ ## Why use it?
19
+
20
+ Session management is fundamental for any application that needs to maintain state across requests, such as user logins. This package provides a robust session solution powered by `express-session` while maintaining the simple, centralized configuration philosophy of `wnodex`.
21
+
22
+ ## Installation
23
+
24
+ You can install the package using your favorite package manager:
25
+
26
+ **pnpm**
27
+
28
+ ```bash
29
+ pnpm add @wnodex/session
30
+ ```
31
+
32
+ **npm**
33
+
34
+ ```bash
35
+ npm install @wnodex/session
36
+ ```
37
+
38
+ **yarn**
39
+
40
+ ```bash
41
+ yarn add @wnodex/session
42
+ ```
43
+
44
+ **bun**
45
+
46
+ ```bash
47
+ bun add @wnodex/session
48
+ ```
49
+
50
+ ## Usage
51
+
52
+ `@wnodex/session` is disabled by default. To enable it, you must provide a configuration object with at least a `secret`.
53
+
54
+ ```typescript
55
+ import { Wnodex } from 'wnodex';
56
+
57
+ // Example: Enable session management
58
+ const server = new Wnodex({
59
+ // cookie-parser is often used with sessions
60
+ cookieParser: { secret: 'cookie-secret' },
61
+ session: {
62
+ secret: 'your-super-secret-key-for-sessions',
63
+ resave: false,
64
+ saveUninitialized: false,
65
+ cookie: {
66
+ secure: process.env.NODE_ENV === 'production',
67
+ maxAge: 86400000, // 24 hours
68
+ },
69
+ },
70
+ });
71
+
72
+ server.start();
73
+ ```
74
+
75
+ The options object is passed directly to the `express-session` library. For production use, it is highly recommended to use a custom session store like `connect-redis` or `connect-mongo`.
12
76
 
13
77
  ## License
14
78
 
package/package.json CHANGED
@@ -1,10 +1,16 @@
1
1
  {
2
2
  "name": "@wnodex/session",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "private": false,
5
- "description": "wnodex session middleware",
5
+ "description": "A wnodex middleware that integrates express-session to create and manage user sessions.",
6
6
  "keywords": [
7
- "wnodex"
7
+ "wnodex",
8
+ "middleware",
9
+ "session",
10
+ "express",
11
+ "express-session",
12
+ "authentication",
13
+ "cookie"
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.1"
48
+ "@wnodex/typescript-config": "0.2.2"
43
49
  },
44
50
  "publishConfig": {
45
51
  "access": "public"