diff --git a/src/controllers/adopt.js b/src/controllers/adopt.js index ed867c9..21556bb 100644 --- a/src/controllers/adopt.js +++ b/src/controllers/adopt.js @@ -2,5 +2,10 @@ const animals = require('../model/animallist') ; exports.get = (req, res) => { - res.render('adopt', { activePage: { animals: true }, animals }); + console.log({animals}); + animals((err,result)=>{ + console.log({err},{result}) + res.render('adopt', { activePage: { animals: true }, animals:result}); + + }) }; diff --git a/src/model/animallist.js b/src/model/animallist.js index da6729f..21d422f 100644 --- a/src/model/animallist.js +++ b/src/model/animallist.js @@ -1,7 +1,7 @@ //link between database and adoption const animalRequest = require('./queries/getData'); -module.exports = getData.getAnimals; +module.exports = animalRequest.getAnimals; diff --git a/src/model/database/build.sql b/src/model/database/build.sql index a55fb7c..1d3cb9d 100644 --- a/src/model/database/build.sql +++ b/src/model/database/build.sql @@ -24,7 +24,7 @@ INSERT INTO users (name) VALUES ('Gregor'), ('Andy'), ('Francesca'), ('Jack'); INSERT INTO animals (name) -VALUES ('Pig'), ('Goat'), ('Tiger'), ('Monkey'); +VALUES ('bisont'), ('elephant'), ('hamster'), ('hippo'),('jellyfish'),('llama'),('monky'),('octopus'); INSERT INTO adoption (user_id, animal_id) VALUES (1,2), (2,1), (2,4), (3,3), (3,1), (4,1); diff --git a/src/views/adopt.hbs b/src/views/adopt.hbs index 446311d..2e9bdcf 100644 --- a/src/views/adopt.hbs +++ b/src/views/adopt.hbs @@ -11,7 +11,8 @@
  • {{!--
    --}}
    - {{this}} + {{this.name}} +