You are using an unsupported browser. Please update your browser to the latest version on or before July 31, 2020.
Home > FAQ > What host should my server listen on?
What host should my server listen on?
print icon

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, 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, '', function(err, address) {


Your code may not have an address explicitly indicated, or it may have a different one (like if you remixed the older version of the Glitch Hello Node project)–make sure you specify if you plan on deploying your app elsewhere.


Specifying 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!

Got more questions? Check out our Community Forum!
Open 24/7, the forum is where Glitch makers help each other and show off all the rad apps that they have created. It's the friendliest community of coders on the Web!
0 out of 0 found this helpful

scroll to top icon