Categories
JavaScript Answers

How to get Node.js Express to listen only on localhost?

Spread the love

To get Node.js Express to listen only on localhost, we call listen with the port only.

For instance, we write

app.listen(3001);

to only listen to port 3001 on localhost for requests.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published.