Created
July 21, 2011 02:32
-
-
Save bnoguchi/1096393 to your computer and use it in GitHub Desktop.
Gist for connect-zip Issue GH-2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var assert = require('assert'), | |
express = require('express'), | |
gzip = require('connect-gzip'); | |
var app = express.createServer(); | |
app.set('view engine', 'jade'); | |
app.use(gzip.gzip()); | |
app.use(express.bodyParser()); | |
app.use(express.cookieParser()); | |
app.use(express.session({secret: 'xxx',})); | |
var name = 1; | |
app.get('/', function(req, res) { | |
var sess = req.session; | |
sess.name || (sess.name = name++); | |
console.log(req.session); | |
// res.redirect('http://google.com/'); | |
res.writeHead(303, { 'Location': 'http://google.com/' }); | |
res.end(); | |
}); | |
app.get('/two', function (req, res) { | |
var sess = req.session; | |
sess.name || (sess.name = name++); | |
console.log(req.session); | |
assert.equal(sess.name, 1); | |
res.render('main', {layout: false}); | |
}); | |
app.listen(3000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"author": "", | |
"name": "GH-273", | |
"version": "0.0.0", | |
"repository": { | |
"url": "" | |
}, | |
"engines": { | |
"node": ">=v0.4.0" | |
}, | |
"dependencies": { | |
"connect-gzip": ">=0.0.0", | |
"express": ">=0.0.0", | |
"jade": ">=0.0.0" | |
}, | |
"devDependencies": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment