Nodejitsu:有没有办法密码保护应用程序?

时间:2012-08-01 15:55:29

标签: javascript authentication http-authentication nodejitsu

使用Nodejitsu:有没有办法密码保护应用程序? 我不确定我是否可以部署.htaccess ...我只需要保护网站免受意外访问者的侵害

感谢

1 个答案:

答案 0 :(得分: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);