Guest User

Untitled

a guest
Sep 13th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. var ServerApp = (function () {
  2. function ServerApp() {
  3. this._App = express();
  4. this._App.use(require('express-session')({secret: 'keyboard cat', resave: true, saveUninitialized: true}));
  5. }
  6. ServerApp.prototype.setRoutes = function () {
  7. this._App.use(express.static('client'));
  8. //this._App.get('/', this._RenderIndex);
  9.  
  10. this._App.get("/cb",
  11. passport.authenticate('github', {failureRedirect: '/login'}),
  12. function (req, res) {
  13. // Successful authentication, redirect home.
  14. res.redirect('/');
  15. }
  16. );
  17.  
  18. this._App.get("/loginScreen",function(req,res){
  19. res.redirect("/#/loginScreen");
  20. });
  21.  
  22. this._App.get("/login",
  23. passport.authenticate('github', {failureRedirect: '/loginScreen'}));
  24.  
  25. this._App.get("/",
  26. require('connect-ensure-login').ensureLoggedIn('/loginScreen'));
  27.  
  28. this._App.get("*",
  29. require('connect-ensure-login').ensureLoggedIn('/loginScreen'));
  30.  
  31. };
Advertisement
Add Comment
Please, Sign In to add comment