Skip to content

Instantly share code, notes, and snippets.

@simeg
Created May 26, 2022 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simeg/52b1bf277d5fe447239b379ea41346d0 to your computer and use it in GitHub Desktop.
Save simeg/52b1bf277d5fe447239b379ea41346d0 to your computer and use it in GitHub Desktop.
Express Node.js Heroku 1
// index.js
const express = require('express');
const app = express();
// Use port from Heroku, fall back to default port
const port = process.env.PORT || 3000;
app.get('/', (req, res) => {
res.send('Hello World!');
});
app.listen(port, () => {
console.log(`App available at http://localhost:${port}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment