Categories
JavaScript Answers

How to bind Express to a specific IP address with Node?

Spread the love

To bind Express to a specific IP address with Node, we call listen with the IP address to bind to.

For instance, we write

const server = app.listen(3000, "127.0.0.1", onServerListening);

to call app.listen with the IP address to bind to as the 2nd argument to bind to 127.0.0.1.

By John Au-Yeung

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

Leave a Reply

Your email address will not be published.