Quellcode durchsuchen

Add route to retrieve all currencies.

Lee Morgan vor 4 Jahren
Ursprung
Commit
0e4df660a1
2 geänderte Dateien mit 10 neuen und 2 gelöschten Zeilen
  1. 10 0
      controllers/currency.js
  2. 0 2
      views/currency/display.html

+ 10 - 0
controllers/currency.js

@@ -56,5 +56,15 @@ module.exports = {
                         return res.redirect("/");
                 }
             });
+    },
+
+    getData: function(req, res){
+        Currency.find()
+            .then((currencies)=>{
+                return res.json(currencies);
+            })
+            .catch((err)=>{
+                console.error(err);
+            });
     }
 }

+ 0 - 2
views/currency/display.html

@@ -6,8 +6,6 @@
         <title>Lee Morgan</title>
     </head>
     <body>
-        <h1>Currencies from around the world</h1>
-
         <div id="container">
             <template id="currency">
                 <div class="currency">