Below is my nodejs code
const express = require(\'express\');
const app = express();
app.use(\'/\', (req, res, next) => {
console.log(\"In intercept
Found that it is happening due to /favicon.ico
request made by browser. Adding specific handler (shown below) prevented default handler from being called twice
app.use('/favicon.ico', (req, res, next) => {
console.log('favicon handler');
res.sendStatus(200);
});
The usual reasons you see multiple requests when a page loads from a browser are one of two things:
You can see exactly what each request is for by adding:
console.log(req.url);
to your middleware.