If you're building a node.js
app, the server address that you specify to listen on may have an impact on what happens if you decide to deploy your app to another platform, like DigitalOcean.
The current versions of all Glitch node.js
starter projects (like ~glitch-hello-node) are setup to listen on 0.0.0.0
, but if you have an older remix or started from a different project, you may need to update yours.
To set your app up for deployment by changing the host IP your server listens on, in your project's server code (this will be server.js
if you remixed a Glitch starter app), find the line where your server is set up to listen–in a project using Fastify it should look something like this:
fastify.listen(process.env.PORT, '0.0.0.0', function(err, address) {
Your code may not have an address explicitly indicated, or it may have a different one (like 127.0.0.1
if you remixed the older version of the Glitch Hello Node project)–make sure you specify 0.0.0.0
if you plan on deploying your app elsewhere.
Specifying 0.0.0.0
means that the app will listen on any available interface, including all IPv4 addresses. This is necessary for deploying your app to DigitalOcean and some other services. The Fastify docs include more info and considerations worth checking out if you're making this change!