Skip to content

Instantly share code, notes, and snippets.

@J3698
Last active June 23, 2019 23:42
Show Gist options
  • Save J3698/63b0e0f448bd20aeef6eb062aba59901 to your computer and use it in GitHub Desktop.
Save J3698/63b0e0f448bd20aeef6eb062aba59901 to your computer and use it in GitHub Desktop.
const express = require('express'); // import express
const app = express();
/*
* A deployment service might set a correct PORT
* to use, if no port is set 5000 will probably
* be free for use.
*/
const port = process.env.PORT || 5000;
// output whether the app runs or errors
app.listen(port, function (err) {
if (err)
console.log(err);
else
console.log("App running");
});
// create our first route
app.get('/greet', (req, res) => {
res.send("hi");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment