aboutsummaryrefslogtreecommitdiffstats
path: root/csci4131
diff options
context:
space:
mode:
authorMatthew Strapp <msattr@gmail.com>2021-04-15 13:03:15 -0500
committerMatthew Strapp <msattr@gmail.com>2021-04-15 13:03:15 -0500
commite6b8297e3cb99dfc753015699c766612fc89655a (patch)
treec6383723090aafba488dd452a76ec35ca38e1597 /csci4131
parenthw6 (diff)
downloadhomework-e6b8297e3cb99dfc753015699c766612fc89655a.tar
homework-e6b8297e3cb99dfc753015699c766612fc89655a.tar.gz
homework-e6b8297e3cb99dfc753015699c766612fc89655a.tar.bz2
homework-e6b8297e3cb99dfc753015699c766612fc89655a.tar.lz
homework-e6b8297e3cb99dfc753015699c766612fc89655a.tar.xz
homework-e6b8297e3cb99dfc753015699c766612fc89655a.tar.zst
homework-e6b8297e3cb99dfc753015699c766612fc89655a.zip
I don't get Express routers
Diffstat (limited to '')
-rw-r--r--csci4131/hw6/strap012_hw6/api/utilities.js3
-rw-r--r--csci4131/hw6/strap012_hw6/index.js7
-rw-r--r--csci4131/hw6/strap012_hw6/public/login.html38
3 files changed, 3 insertions, 45 deletions
diff --git a/csci4131/hw6/strap012_hw6/api/utilities.js b/csci4131/hw6/strap012_hw6/api/utilities.js
index 6b6cec6..eda6e72 100644
--- a/csci4131/hw6/strap012_hw6/api/utilities.js
+++ b/csci4131/hw6/strap012_hw6/api/utilities.js
@@ -3,8 +3,9 @@ const router = express.Router()
router.get('/contacts', function (req, res) {
// TODO: Implement code to fetch contacts from the database
+ res.send("AAAAAAAAAAAA")
});
// TODO: Add implementation for other necessary end-points
-module.exports = router; \ No newline at end of file
+module.exports = router;
diff --git a/csci4131/hw6/strap012_hw6/index.js b/csci4131/hw6/strap012_hw6/index.js
index 6ce24c2..965b23e 100644
--- a/csci4131/hw6/strap012_hw6/index.js
+++ b/csci4131/hw6/strap012_hw6/index.js
@@ -84,11 +84,6 @@ app.post('/logintry', function(req, res) {
});
-
-// TODO: Add implementation for other necessary end-points
-
-
-
// Makes Express use a router called utilities
app.use('/api', utilities);
@@ -107,4 +102,4 @@ app.use(function (err, req, res, next) {
res.status(err.status || 500);
// res.render('error');
res.send();
-}); \ No newline at end of file
+});
diff --git a/csci4131/hw6/strap012_hw6/public/login.html b/csci4131/hw6/strap012_hw6/public/login.html
deleted file mode 100644
index 34bbc8c..0000000
--- a/csci4131/hw6/strap012_hw6/public/login.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<html>
-
-<head>
- <script src="https://code.jquery.com/jquery-2.2.4.min.js"integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
-</head>
-
-<body>
- <form id="myForm" name="myForm">
- <div>
- <label for="login">login:</label>
- <input type="text" id="login" name="login">
- </div>
- <div>
- <label for="password">password:</label>
- <input type="text"id="password"name="password">
- </div>
- <input type="submit"value="Submit!">
- </form>
- <script>
- $(document).ready(function () {
- $('#myForm').submit(function (event) {
- event.preventDefault();//collect the form data using Id Selector for whatever data you need to send to server
- let login=$('#login').val();
- let password=$('#password').val();
- $.post('logintry',
- {"login": login,"password": password},
- (data) => {
- console.log(data);
- if(data.status === 'success'){
- //pseudo code
- //Make sure error message is not displayed
- //Re-direct to contacts page,
- window.location.href='contacts';}
- else{
- //Display error message
- }});});});</script>
-
-</html> \ No newline at end of file