1.5.0 • Published 6 years ago
@sr-net/session-middleware v1.5.0
session-middleware
Usage
The middleware needs a sr-net/auth
service to use. Clone and run it locally before using this middleware.
import { Session } from '@sr-net/session-middleware'
app.use(
Session({
url: 'http://localhost:3100', // Url to running auth service
domain: 'stratroulette.net', // Domain server is running on
})
)
app.use(ctx => {
ctx.session.id // Session ID
ctx.session.maxAge // Session lifetime
ctx.session.user // Session's User, if logged in
ctx.session.isLoggedIn // Alias for !!ctx.session.user
ctx.session.identifier // User UUID if logged in, otherwise Session ID
ctx.session.foo = 'baz' // Set any variable and it will be saved to the Auth service
})
Testing
yarn test
1.5.0
6 years ago
1.4.2
6 years ago
1.4.1
6 years ago
1.4.0
6 years ago
1.3.9
6 years ago
1.3.8
6 years ago
1.3.7
6 years ago
1.3.6
6 years ago
1.3.5
6 years ago
1.3.4
6 years ago
1.3.3
6 years ago
1.3.2
6 years ago
1.3.1
6 years ago
1.3.0
6 years ago
1.2.0
6 years ago
1.1.3
6 years ago
1.1.2
6 years ago
1.1.1
6 years ago
1.1.0
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago
1.0.0
6 years ago