Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var express = require('express');
  2. var app = express();
  3. var basicAuth = require('basic-auth-connect');
  4. // Include your route
  5. var clients = require('./routes/clients');
  6.  
  7. // Initialize Auth Object
  8. var auth = basicAuth(function(user, pass) {
  9.     return((user ==='josh')&&(pass === 'cockrell'));
  10. });
  11.  
  12. // Define your route, pass in auth, and included route
  13. app.get('/clients', auth, clients);
  14.  
  15. app.listen(3000, function () {
  16.   console.log('Example app listening on port 3000!');
  17. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement