I couldn't reproduce your issue. I tried really hard to reproduce it.
I created the same controller you have in your question, and I ran the code -- but not in WebStorm, I ran it from the command line. Since you're using console.log("test")
, I should be able to see the console output test
twice if your code is doing what you're saying it's doing, however, I couldn't get that to happen:
As you can see from the screenshot, the console output test
once, and the webbrowser output a response of test
, which exactly matches the code you've given:
module.exports = {
test: function(req, res){
console.log('test') //output test to console
res.json('test') //output test to the response
}
};
I can't reproduce the issue as you've shown it; and there's no indication that controller is getting executed twice.