Skip to content

Instantly share code, notes, and snippets.

@Enome
Created August 11, 2012 20:00
Show Gist options
  • Save Enome/3326750 to your computer and use it in GitHub Desktop.
Save Enome/3326750 to your computer and use it in GitHub Desktop.
var http = require('http');
var express = require('express');
var app = express();
app.set('view engine', 'jade');
app.set('views', __dirname + '/views');
app.locals.global = 'global';
app.use(function (req, res, next) {
res.locals.local = 'local';
next();
});
app.get('/', function (req, res, next) {
res.render('index');
});
http.createServer(app).listen(3002);
-console.log(locals); // { [Function: locals] local: 'local' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment