1

my route is calling twice,am using express, I have checked some link related to this

node.js page refresh calling resources twice?

so i have added console.log(req.url),

My output is

Hi..
/
Hi..
/

My code:

app.get('/', function (req, res) {
console.log("Hi..")
console.log(req.url)
});

How do i solve this issue?

Vishnu
  • 745
  • 12
  • 32
  • Try logging time, `console.log("We got a hit @ " + new Date());` – kgangadhar Jan 25 '18 at 06:17
  • We got a hit @ Thu Jan 25 2018 11:54:56 GMT+0530 (India Standard Time) We got a hit @ Thu Jan 25 2018 11:54:57 GMT+0530 (India Standard Time) Am getting in seconds delay .. so its running twice..How to avoid that – Vishnu Jan 25 '18 at 06:25
  • Your route is getting called twice when you do what? What exactly did you do to cause it to get hit? Did you go to some URL in a browser? What URL? Did you post a form via Javascript in a web page? Is there any Javascript in your web page? – jfriend00 Jan 25 '18 at 07:33
  • Am just loading login page. it contains captcha ,if i tried after clear history its working fine but after some time it calling twice – Vishnu Jan 25 '18 at 07:41

0 Answers0