This repository has been archived on 2018-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
node-task/routes/index.js

29 lines
530 B
JavaScript
Raw Normal View History

2014-09-18 15:35:58 -04:00
var express = require('express');
var router = express.Router();
2014-09-24 17:58:53 -04:00
/* GET Home / Login Form */
2014-09-18 15:35:58 -04:00
router.get('/', function(req, res) {
2014-09-24 17:58:53 -04:00
var util = require('util');
var request = util.inspect(req, {depth: 2});
2014-10-01 10:45:09 -04:00
2014-09-24 17:58:53 -04:00
// If the user isn't logged in
if ( ! req.session.uid)
{
res.render('login', {
title: 'Node Task Manager',
csrfToken: req.csrfToken()
});
}
else
{
res.render('index', {
title: 'Node Task Manager',
user: req.session.username,
2014-10-01 10:45:09 -04:00
req: request,
loggedin: true
2014-09-24 17:58:53 -04:00
});
}
});
2014-09-18 15:35:58 -04:00
module.exports = router;