Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2014
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. app.use('/*', function(req, res, next) {
  2.     if (req.subdomains.length >= 1) {
  3.         myDB.User.find({where: { subdomain: req.subdomains[0] }}).success(function(result) {
  4.             req.user = result; // assuming we found one, you get the idea
  5.             next();
  6.         });
  7.     } else {
  8.         next(); // we don't have a user object, no need to attach it
  9.     }
  10. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement