Implementable session interface
A implementable session interface. Supports session objects as well as CSRF tokens. Born out out of https://github.com/senchalabs/connect/issues/935.
- This is low-level, meaning it's just a constructor and a bunch of methods. You would have to create your own middleware for your own framework such as connect/express.
- Most methods and properties on the prototype are implementable, meaning you can change things however you'd like.
- All async methods return a thunk for easy integration with generator-based control flow frameworks such as co
Create a new session instance for a particular request.
appuse// Only the session constructorreq_session = req res// Get the actual session object and attach it toreq_sessiongetSessionif errreturn nexterrreqsession = sessionnext
Creates a new, yet equivalent,
Do this so that you don't butcher the original prototype.
prototype are additional properties to attach to the new prototype.
The following are equivalent:
var App1Session = SessionextendmaxAge: 60var App1Session = Sessionextend60
The MIT License (MIT)
Copyright (c) 2013 Jonathan Ong email@example.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.