You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+88-2Lines changed: 88 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,92 @@
6
6
7
7
DynamoDB is an excellent choice for session stores because it is a fully managed service that is highly available, durable, and can scale automatically (to nearly unlimited levels) to meet demand. DynamoDB reads will typically return in 1-3 ms if capacity is set correctly and the caller is located in the same region as the `Table`.
8
8
9
+
# Getting Started
10
+
11
+
## Installation
12
+
13
+
The package is available on npm as [@pwrdrvr/dynamodb-session-store](https://www.npmjs.com/package/@pwrdrvr/dynamodb-session-store)
maxAge: 14*24*60*60*1000, // 14 days in milliseconds
70
+
},
71
+
resave: false,
72
+
saveUninitialized: false,
73
+
}),
74
+
);
75
+
76
+
app.get('/login', (req, res) => {
77
+
console.log(`Session ID: ${req.session?.id}`);
78
+
req.session.user='test';
79
+
res.send('Logged in');
80
+
});
81
+
82
+
app.get('/*', (req, res) => {
83
+
res.status(200).send('Hello world');
84
+
});
85
+
86
+
app.listen(Number.parseInt(PORT, 10), () => {
87
+
console.log(`Example app listening on port ${port}`);
88
+
});
89
+
```
90
+
91
+
## API Documentation
92
+
93
+
After installing the package review the [API Documentation](https://pwrdrvr.github.io/dynamodb-session-store/classes/DynamoDBStore.html) for detailed on each configuration option.
94
+
9
95
# Features
10
96
11
97
- Configurability of `Strongly Consistent Reads`
@@ -23,8 +109,8 @@ DynamoDB is an excellent choice for session stores because it is a fully managed
23
109
24
110
# Configuration Tips
25
111
26
-
- Use a Table per-region if you are deployed in multiple regions
27
-
- Use a Table per-environment if you are deployed in multiple environments (e.g. dev/qa/prod)
112
+
- Use a Table per-region if the app is deployed in multiple regions
113
+
- Use a Table per-environment if the app is deployed in multiple environments (e.g. dev/qa/prod)
28
114
- Use a Table unique to the session store - do not try to overload other data into this Table as the scaling and expiration needs will not overlap well
29
115
- For applications attached to a VPC (including Lambda's attached to a VPC), use a VPC Endpoint for DynamoDB to avoid the cost, latency, and additional reliability exposure of crossing NAT Gateway to reach DynamoDB
30
116
- Use Provisioned Capacity with auto-scaling to avoid throttling and to achieve the lowest cost - On Demand seems nice but it is costly
0 commit comments