Skip to content

Fully initialized object fix for a null options object passed to session #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions lib/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,19 @@ express.io.routeForward = middleware.routeForward
session = express.session
delete express.session
sessionConfig = new Object

express.session = (options) ->
options ?= new Object
options.key ?= 'connect.sid'
options.store ?= new session.MemoryStore
options.cookie ?= new Object
sessionConfig = options
return session options
if options is null
options =
key: "connect.sid"
store: session.MemoryStore
cookie:
path: "/"
httpOnly: true
secure: false
maxAge: {}
session options

for key, value of session
express.session[key] = value

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"keywords": ["realtime", "web", "framework", "express.io", "express", "socket.io", "badass"],
"homepage": "http://express-io.org",
"author": "Brad Carleton <[email protected]>",
"repository": "git://github.com/techpines/express.io",
"repository": "git://github.com/killerbobjr/express.io",
"contributors": [{
"name": "Brad Carleton",
"email": "[email protected]",
Expand Down Expand Up @@ -35,13 +35,13 @@
"mocha": "*",
"chai": "*",
"socket.io-client": "*",
"jade": "*"
"jade": "*",
"shelljs-nodecli": "*"
},
"main": "switch.js",
"scripts": {
"test": "./node_modules/mocha/bin/mocha test/test.coffee",
"compile": "./node_modules/coffee-script/bin/coffee -o compiled/ -c lib/",
"prepublish": "echo $(pwd) > /tmp/.pwd; ./node_modules/coffee-script/bin/coffee -o compiled/ -c lib/;",
"postpublish": "rm -rf $(cat /tmp/.pwd)/compiled"
"prepublish": "node ./scripts/prepublish.js"
}
}
4 changes: 4 additions & 0 deletions scripts/prepublish.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
var shell = require('shelljs-nodecli/node_modules/shelljs');
var cli = require('shelljs-nodecli');
shell.mkdir('-p', 'compiled');
cli.exec('coffee', '-o compiled/', '-c lib');