0

enter image description hereI have written Node API and I have uploaded in Heroku but when I want to open any other router then It shows me some error like application error. Even I got to add Procfile but there was issue Application error below I've seen "heroku logs --tail" i followed the same command but at Error and H12 i got

Can any one help me out thanks adv

Kiran Reddy
  • 347
  • 1
  • 4
  • 14
  • do you use any framework like express for example ? and could you post the code the handle the corresponding route ? – Edwin Harly Aug 14 '18 at 05:46
  • I have used express framework do you want me to paste code here ? that's thousands of lines dude even i have only one server.js file which is running main file in server and it has some req and res – Kiran Reddy Aug 14 '18 at 05:54
  • for me, it's kinda hard to identify what has caused the error, you can use gist.github.com to share your code – Edwin Harly Aug 14 '18 at 06:05
  • ok wait I will share my code then – Kiran Reddy Aug 14 '18 at 06:13
  • https://github.com/getinfyKiranreddy/api here you can check my code can you help me fast I need to do more pages dynamic .I have been doing for 3 days – Kiran Reddy Aug 14 '18 at 06:21
  • If you can't post code, you should be able to find an answer to your question here: https://devcenter.heroku.com/articles/request-timeout My guess is that you forgot to res.sendfile(__dirname + 'what/ever/image.jpg') – LJD Aug 14 '18 at 06:26
  • inside `aboutus.find()` callback add this line `if (err) { console.error(err); }`, then try to access the route again, it should gives you more information about the error – Edwin Harly Aug 14 '18 at 06:27
  • what I have to do now do i need to change the error at aboutus.find() line? – Kiran Reddy Aug 14 '18 at 06:32
  • @KiranReddy see my answer below – Edwin Harly Aug 14 '18 at 06:39

1 Answers1

0

I think you forgot the required params on your aboutus.find(), which is an object. If you mean to do a find all query, you need to supply empty object on the first param, try this

aboutus.find({}, (err, data1) => {
            if (err) throw err;
            res.render('aboutus_edit.ejs', {
                aboutus: data1
            });
    })

reference: http://mongoosejs.com/docs/api.html#model_Model.find

Edwin Harly
  • 439
  • 1
  • 5
  • 13