使用Nodejitsu:有没有办法密码保护应用程序? 我不确定我是否可以部署.htaccess ...我只需要保护网站免受意外访问者的侵害
感谢
答案 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);