Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
dnode-session
Advanced tools
DNode session handling and integration with Express session storage
npm install dnode-session
or from source
git clone git://github.com/tblobaum/dnode-session.git
cd dnode-session
npm link
key
session key (optional, default connect.sid
)store
session store objectkeepAlive
persist session with socket connection (optional, default true
)interval
refresh rate for keep alive (optional, default 120000
)Pass the same session store into dnodeSession as you did with express for integration
var dnode = require('dnode')
, dnodeSession = require('dnode-session')
, express = require('express')
, redisStore = require('connect-redis')(express)
, server = express.createServer()
, sessionStore = new redisStore()
server.use(express.session({
secret: 'agent'
, store: sessionStore
})
dnode()
.use(dnodeSession({
store: sessionStore
}))
.listen(server)
server.listen()
###Basic usage
dnodeSession({
store: sessionStore
})
###Full configuration
dnodeSession({
store: sessionStore // session store object
, key: 'connect.sid' // (optional) session key
, keepAlive: true // (optional) keep session alive with dnode connection
, interval: 120000 // (optional) keep alive refresh rate
})
###Session manipulation
dnode.use(function(client, conn) {
this.session(function(err, sess) {
sess.foo = 'bar'
sess.save()
})
})
Within the client and server, dnode-session supplies the following methods.
###session(callback)
Return the session storage object, which can be modified
session(function(err, sess) {
// ...
})
###cookies(callback)
Return the cookies that would be available from req.cookies
in express
cookies(function(cookies) {
// ...
})
(The MIT License)
Copyright (c) 2011-2012 Tom Blobaum tblobaum@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Expose your connect/express sessions to dnode
The npm package dnode-session receives a total of 1 weekly downloads. As such, dnode-session popularity was classified as not popular.
We found that dnode-session demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.