In my router
Router.get('/login', IndexController.login);
In my controller
exports.login = (req,res,next)=>{
console.log('login get');
res.render('main/login',{pageTitle: 'Login'});
};
The console logs login get twice, meaning that this is called twice. If I remove the render call then it is logged only once. I have been trying to debug for several days now but still cant seem to figure this one out. When using a curl request from another terminal the log is seen only once as well, but using chrome/firefox/IE yields the double or sometimes triple log call. I don't see this behaviour with POST calls however. -EJS -EXPRESS -Node
UPDATE In chrome dev tools, after inspecting the network tab, I only see 1 GET request being made for the page.
My guess is that your view is making a request you were not planning on. Maybe a favicon or an xhr reuest? I would check your browser network tab.
Thanks for the reply @wesleytodd I checked the network tab as you suggested, I notice an initial request followed at some point later by another request to the same URL not sure why that one is being called, but an "img" requested it. Are you familiar with how to resolve this? or should I just tinker with all the images until i figure it out?
Ok Following your advice @wesleytodd I discovered it was an extra call from an img tag on the page, it seems it was making an extra url call.
Most helpful comment
Ok Following your advice @wesleytodd I discovered it was an extra call from an img tag on the page, it seems it was making an extra url call.