Gathering detailed insights and metrics for @midwayjs/session
Gathering detailed insights and metrics for @midwayjs/session
Gathering detailed insights and metrics for @midwayjs/session
Gathering detailed insights and metrics for @midwayjs/session
🍔 A Node.js Serverless Framework for front-end/full-stack developers. Build the application for next decade. Works on AWS, Alibaba Cloud, Tencent Cloud and traditional VM/Container. Super easy integrate with React and Vue. 🌈
npm install @midwayjs/session
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (62.04%)
Shell (34.86%)
JavaScript (2.91%)
CSS (0.15%)
HTML (0.03%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
7,586 Stars
4,117 Commits
584 Forks
98 Watchers
33 Branches
174 Contributors
Updated on Jul 13, 2025
Latest Version
3.20.5
Package Id
@midwayjs/session@3.20.5
Unpacked Size
42.80 kB
Size
12.40 kB
File Count
24
NPM Version
lerna/7.4.2/node@v18.20.4+arm64 (darwin)
Node Version
18.20.4
Published on
Apr 27, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
2
Session component for @midwayjs/koa and @midwayjs/faas
1$ npm i @midwayjs/session --save
@midwayjs/koa has enabled this component by default, @midwayjs/faas needs to be manually enabled.
1// src/configuration.ts 2 3import { join } from 'path'; 4import * as faas from '@midwayjs/faas'; 5import * as session from '@midwayjs/session'; 6 7@Configuration({ 8 imports: [ 9 faas, 10 session, 11 ], 12 // ... 13}) 14export class ContainerLifeCycle implements ILifeCycle {} 15
You can configure session in your config.*.ts
.
default value.
1export const session = { 2 maxAge: 24 * 3600 * 1000, // ms 3 key: 'mw.sess', 4 httpOnly: true, 5 encrypt: true, 6 // sameSite: null, 7 logValue: true, 8};
you can use all config from koa-session.
Write a session store class first, extends abstract SessionStore
class.
1import { SessionStore } from '@midwayjs/session'; 2 3@Provide() 4@Scope(ScopeEnum.Singleton) 5export class MemorySessionStore extends SessionStore { 6 sessions = {}; 7 async get(key) { 8 return this.sessions[key]; 9 } 10 11 async set(key, value) { 12 this.sessions[key] = value; 13 } 14 15 async destroy(key) { 16 this.sessions[key] = undefined; 17 } 18}
add custom sessionStore to session component.
1import { MemorySessionStore } from './store'; 2import * as session from '@midwayjs/session'; 3 4@Configuration({ 5 imports: [ 6 koa, 7 session, 8 ], 9 //... 10}) 11export class AutoConfiguration { 12 @Inject() 13 memoryStore: MemorySessionStore; 14 15 @Inject() 16 sessionStoreManager: session.SessionStoreManager; 17 18 async onReady() { 19 this.sessionStoreManager.setSessionStore(this.memoryStore); 20 } 21}
Please open an issue here.
MIT
No vulnerabilities found.
Reason
21 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 3/17 approved changesets -- score normalized to 1
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
project is not fuzzed
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
46 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
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