Gathering detailed insights and metrics for @midwayjs/express-session
Gathering detailed insights and metrics for @midwayjs/express-session
npm install @midwayjs/express-session
Typescript
Module System
Min. Node Version
Node Version
NPM Version
69.2
Supply Chain
97.8
Quality
94.3
Maintenance
100
Vulnerability
100
License
TypeScript (62.09%)
Shell (34.75%)
JavaScript (2.97%)
CSS (0.15%)
HTML (0.03%)
Total Downloads
24,243
Last Day
10
Last Week
166
Last Month
356
Last Year
5,350
7,460 Stars
4,080 Commits
578 Forks
100 Watching
33 Branches
172 Contributors
Minified
Minified + Gzipped
Latest Version
3.20.0
Package Id
@midwayjs/express-session@3.20.0
Unpacked Size
13.93 kB
Size
4.48 kB
File Count
14
NPM Version
lerna/7.4.2/node@v18.20.4+arm64 (darwin)
Node Version
18.20.4
Publised On
14 Jan 2025
Cumulative downloads
Total Downloads
Last day
-47.4%
10
Compared to previous day
Last week
191.2%
166
Compared to previous week
Last month
3.2%
356
Compared to previous month
Last year
-49.8%
5,350
Compared to previous year
2
4
Session component for @midwayjs/express
1$ npm i @midwayjs/express-session --save 2$ npm i @types/express-session --save-dev
@midwayjs/express has enabled this component by default.
We use cookie-session to keep session by default and use express-session when set custom session store.
You can configure session in your config.*.ts
.
default value.
1export const session = { 2 secret: undefined, // must be set in application 3 name: 'MW_SESS', 4 cookie: { 5 maxAge: 24 * 3600 * 1000, // ms 6 httpOnly: true, 7 // sameSite: null, 8 }, 9};
You can set 'session.cookie' for cookie-session config.
You can use compatible session store here.
Let's give an example for memorystore.
1import { Configuration, Inject } from '@midwayjs/core'; 2import * as session from '@midwayjs/express-session'; 3import MemoryStore = require('memorystore'); 4 5@Configuration({ 6 imports: [ 7 express, 8 session, 9 ], 10 //... 11}) 12export class AutoConfiguration { 13 @Inject() 14 sessionStoreManager: session.SessionStoreManager; 15 16 async onReady() { 17 this.sessionStoreManager.setSessionStore(MemoryStore, { 18 checkPeriod: 86400000 // prune expired entries every 24h 19 }); 20 } 21}
Another example for connect-redis.
1import { Configuration, Inject } from '@midwayjs/core'; 2import * as session from '@midwayjs/express-session'; 3import RedisStore from "connect-redis" 4import {createClient} from "redis" 5 6// Initialize client. 7let redisClient = createClient() 8redisClient.connect().catch(console.error) 9 10@Configuration({ 11 imports: [ 12 express, 13 session, 14 ], 15 //... 16}) 17export class AutoConfiguration { 18 @Inject() 19 sessionStoreManager: session.SessionStoreManager; 20 21 async onReady() { 22 // Initialize store. 23 this.sessionStoreManager.setSessionStore(RedisStore, { 24 client: redisClient, 25 prefix: "myapp:", 26 // ... 27 }); 28 } 29}
Please open an issue here.
MIT
No vulnerabilities found.
Reason
30 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
no binaries found in the repo
Reason
Found 4/11 approved changesets -- score normalized to 3
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
34 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More