I've an odd problem: I have a very simple node/expressjs app (I have a much more complex one but this simple example shows the problem). This app has three routes, as shown here:
var i = 0;
app.route('/login')
.get(function(req, res){
console.log('login', ++i);
res.send('login');
})
app.route('/test')
.get(function(req, res){
console.log('test', ++i);
res.send('test');
})
app.route('/')
.get(function(req, res){
console.log('index', ++i);
res.send('index');
})
Pretty simple. Any time one of these routes is requested, i
is incremented and logged, and it works fine, except when the chrome dev tools pane is open. When the dev tools are open, requesting either login or test will fire two requests. Here is the results of the log:
15:45:30 web.1 | index 1
15:45:33 web.1 | login 2
15:45:34 web.1 | login 3
15:45:37 web.1 | test 4
15:45:37 web.1 | test 5
15:45:41 web.1 | login 6
15:45:42 web.1 | login 7
15:45:45 web.1 | test 8
15:45:45 web.1 | test 9
15:45:48 web.1 | index 10
What's going on here. Is it a Chrome bug?
This is a semi-known issue with chrome.
Google has a discussion here that discusses possible work arounds-- I haven't found a real solution, but this should give you a good head start.