Skip to content

Instantly share code, notes, and snippets.

@Marak
Forked from desmondmorris/gist:2431305
Created April 20, 2012 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Marak/2431401 to your computer and use it in GitHub Desktop.
Save Marak/2431401 to your computer and use it in GitHub Desktop.
app.router.get('/:slug', function (slug) {
var that = this;
Shortlink.find( {slug: slug} , function (err, shortlink) {
if (err) { throw new(Error)(err) }
console.log( that.req ); // This returns "undefined" and I think I understand why.
// How do I access request and response objects from within
// an anon callback like this one?
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment