title: How to password protect nodejs application using alternative to htaccess
body: <p>I have a site hosted in aws with www.domain.com with 2 sub domains test.domain.com and stage.domain.com. I am using MEAN for development, now what i want is to password protected my sub domains test.domain.com and stage.domain.com but in a similar fashion as we do in php using htaccess.</p>
  
  <p>Now i personally like this htaccess approach because in this approach your code for the application will be same, authentication will be added by htaccess. <strong>Any idea how to do that in nodejs without altering application code, so that i can remove that in future if i want</strong>.</p>
  
  <p>P.S. : Only hints are welcomed.</p>