2

using Nodejitsu: is there a way to password protect the apps? i'm not sure if i can deploy an .htaccess or so... i just need to protect the site from accidental visitors

thanks

Francesco
  • 24,839
  • 29
  • 105
  • 152
  • 1
    Is this what you're looking for? http://stackoverflow.com/questions/5951552/basic-http-authentication-in-node-js – George Aug 01 '12 at 16:04
  • thanks! sounds the exact topic i was looking for...i'm newbie in nodeJs didn't know was possible! – Francesco Aug 01 '12 at 16:06
  • 1
    @GeorgeP Turn your comment into an answer so this can be marked as answered, please. – Sly Oct 01 '12 at 23:46

1 Answers1

0
//Load express
var express = require('express');

//User validation
  var auth = express.basicAuth(function(user, pass) {     
   return (user == "super" && pass == "secret");
  },'Super duper secret area');

 //Password protected area
 app.get('/admin', auth, routes.admin);
jmontross
  • 3,533
  • 1
  • 21
  • 17