Express JS route continues to execute endlessly

149
January 30, 2018, at 2:49 PM

I am new to Express JS and Node in general, and I am having a slight problem here that I don't understand its reason.

So basically, this is my code for index.js:

const express = require('express')
const app = express();
app.get('/', (req, res) => {
    console.log("Continuous message!");
    res.send("Hello World");
});
app.listen(3000, () => console.log('Example app listening on port 3000!')
)

Everything works great except for one thing. In my console the message "Continuous message!" keeps showing up endlessly in my console. Am I doing anything wrong here? Or is this the normal behavior here?

Thank you!

Update: the reason turned out to be the redirection from port 80 to port 3000. So I edited server's site-available and the repetition no longer occurs. Question is now, how do I configure my AWS EC2 server to redirect traffic from port 80 to port 3000 without previous problem?

READ ALSO
How to properly integrate a MySQL model to be used for posting to a table - NodeJS

How to properly integrate a MySQL model to be used for posting to a table - NodeJS

I was able to create a working model with npm install mysql-model (ref: https://wwwnpmjs

132
How to scrape JSON from puppeteer?

How to scrape JSON from puppeteer?

I login to a site and it gives a browser cookie

289
nodej js-beautify prevent code to break in new line

nodej js-beautify prevent code to break in new line

How to make the html tag/script tag 1 line if there is no content inside? there are other cases like etcbut when I run js-beautify

125