Francesco
Francesco

Reputation: 25239

Nodejitsu: is there a way to password protect the apps?

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

Upvotes: 2

Views: 237

Answers (1)

jmontross
jmontross

Reputation: 3581

//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);

Upvotes: 0

Related Questions