Skip to content

Commit

Permalink
Allow for active port to be configured through PORT env var
Browse files Browse the repository at this point in the history
Heroku uses dynamic port assignment, so this allows Heroku to connect to
the application using the port it's assigned. The default port of 3000
is still available for local development.
  • Loading branch information
danlivings-dxw committed Oct 14, 2024
1 parent 8d283c4 commit c779301
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const httpServer = createServer(async (request, response) => {
return response.end(template);
});

const PORT = 3000;
const PORT = process.env.PORT || 3000;
httpServer.listen(PORT, () => {
console.info(`Server is running on port ${PORT}`);
});

0 comments on commit c779301

Please sign in to comment.