I have my first node.js app (runs fine locally) - but I am unable to deploy it via heroku (first time w/ heroku as well). The code is below. SO doesn\'t let me write so much
I had same issue but with express and apollo-server. The solution from here:
The only special consideration that needs to be made is to allow heroku to choose the port that the server is deployed to. Otherwise, there may be errors, such as a request timeout.
To configure apollo-server to use a port defined by Heroku at runtime, the listen function in your setup file can be called with a port defined by the PORT environment variable:
> server.listen({ port: process.env.PORT || 4000 }).then(({ url }) => {
> console.log(`Server ready at ${url}`); });