diff options
author | Matthew Strapp <msattr@gmail.com> | 2021-04-16 21:37:26 -0500 |
---|---|---|
committer | Matthew Strapp <msattr@gmail.com> | 2021-04-16 21:37:26 -0500 |
commit | 0c7bb17b8c955254c2db61a5fe9c8240ea1357e2 (patch) | |
tree | 1aa1a6234807c7b03339cad7b9c04ad1a0b976ed /csci4131/hw6/strap012_hw6/index.js | |
parent | aaaaaaaaaaaaaaaaaaaaaa (diff) | |
download | homework-0c7bb17b8c955254c2db61a5fe9c8240ea1357e2.tar homework-0c7bb17b8c955254c2db61a5fe9c8240ea1357e2.tar.gz homework-0c7bb17b8c955254c2db61a5fe9c8240ea1357e2.tar.bz2 homework-0c7bb17b8c955254c2db61a5fe9c8240ea1357e2.tar.lz homework-0c7bb17b8c955254c2db61a5fe9c8240ea1357e2.tar.xz homework-0c7bb17b8c955254c2db61a5fe9c8240ea1357e2.tar.zst homework-0c7bb17b8c955254c2db61a5fe9c8240ea1357e2.zip |
finish hw6
Diffstat (limited to 'csci4131/hw6/strap012_hw6/index.js')
-rw-r--r-- | csci4131/hw6/strap012_hw6/index.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/csci4131/hw6/strap012_hw6/index.js b/csci4131/hw6/strap012_hw6/index.js index 474b165..851b096 100644 --- a/csci4131/hw6/strap012_hw6/index.js +++ b/csci4131/hw6/strap012_hw6/index.js @@ -49,15 +49,19 @@ app.get('/', function (req, res) { // GET method route for the contacts page. // It serves contact.html present in public folder app.get('/contacts', function(req, res) { - if(!req.session.value) { + if(!req.session.user) { res.redirect('/login'); } else { res.sendFile(path.join(__dirname, 'public/contacts.html')); } }); +app.get('/stocks', function(req, res) { + res.redirect('/stock'); +}) + app.get('/stock', function (req, res) { - if (!req.session.value) { + if (!req.session.user) { res.redirect('/login'); } else { res.sendFile(path.join(__dirname, 'public/stock.html')); @@ -65,7 +69,7 @@ app.get('/stock', function (req, res) { }); app.get('/addContact', function (req, res) { - if (!req.session.value) { + if (!req.session.user) { res.redirect('/login'); } else { res.sendFile(path.join(__dirname, 'public/addContact.html')); @@ -73,13 +77,17 @@ app.get('/addContact', function (req, res) { }); app.get('/login', function (req, res) { - if (req.session.value) { + if (req.session.user) { res.redirect('/contacts'); } else { res.sendFile(path.join(__dirname, 'login.html')); } }); +app.get('/logout', function(req, res) { + res.redirect('/api/logout') +}); + // Makes Express use a router called utilities app.use('/api', utilities); |