Skip to content
Myr

Added -s, --session[s] support to express(1)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This adds cookieDecoder() / session() middleware for you

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent d909dd2 · Browse files · 2 files+29 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+29 added−7 removed

  • other:+29 added−7 removed

2 files+29 added−7 removed

modified:bin/express+27 added-6 removed
19 unmodified lines
2021var stdin;2223/**24 * Add session support.25 */2627var sessions = false;2829/**30 * CSS engine to utilize.31 */3233var cssEngine = 'none';
5 unmodified lines
39var usage = ''40 + '\x1b[1mUsage\x1b[0m: express [options] [PATH]\n'41 + '\n'42 + '\x1b[1mOptions\x1b[0m:\n'43 + ' -s, --sessions Add session support\n'37 + ' -c, --css ENGINE Utilize stylesheet ENGINE (less|sass). Defaults to plain css\n'38 + ' -v, --version Output framework version\n'39 + ' -h, --help Output help information\n';44 + ' -c, --css ENGINE Add stylesheet ENGINE support (less|sass). Defaults to plain css\n'45 + ' -v, --version Output framework version\n'46 + ' -h, --help Output help information\n'47 ;4849/**50 * Jade layout template.51 */
93 unmodified lines
145 , 'app.configure(function(){'146 , ' app.set(\'views\', __dirname + \'/views\');'147 , ' app.set(\'view engine\', \'jade\');'148 , ' app.use(express.bodyDecoder());'141 , ' app.use(express.methodOverride());__CSS__'149 , ' app.use(express.methodOverride());:SESS:CSS'150 , ' app.use(app.router);'151 , ' app.use(express.staticProvider(__dirname + \'/public\'));'152 , '});'153 , ''
39 unmodified lines
193 case '-v':194 case '--version':195 abort(version);196 break;197 case '-s':198 case '--session':199 case '--sessions':200 sessions = true;201 break;202 case '-c':203 case '--css':204 args.length205 ? (cssEngine = args.shift())
53 unmodified lines
259 });260 mkdir(path + '/test', function(){261 write(path + '/test/app.test.js', appTest);262 });263264 // CSS Engine support265 switch (cssEngine) {266 case 'sass':267 case 'less':253 app = app.replace('__CSS__', '\n app.use(express.compiler({ src: __dirname + \'/public\', enable: [\'' + cssEngine + '\'] }));');268 app = app.replace(':CSS', '\n app.use(express.compiler({ src: __dirname + \'/public\', enable: [\'' + cssEngine + '\'] }));');269 break;270 default:256 app = app.replace('__CSS__', '');271 app = app.replace(':CSS', '');272 }273274 // Session support275 app = app.replace(':SESS', sessions276 ? '\n app.use(express.cookieDecoder());\n app.use(express.session());'277 : '');278279 write(path + '/app.js', app);280 });281}282
81 unmodified lines
modified:docs/executable.md+2 added-1 removed