Skip to content

Instantly share code, notes, and snippets.

@mailtoharshit
Last active October 3, 2016 06:11
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 mailtoharshit/5726dc697c2ef1a0bdf5718d80c3f713 to your computer and use it in GitHub Desktop.
Save mailtoharshit/5726dc697c2ef1a0bdf5718d80c3f713 to your computer and use it in GitHub Desktop.
var express = require('express');
var app = express();
var path = require('path');
//Env for Heroku (dyanmically adjusted)
var port = process.env.PORT || 8080;
// viewed at http://localhost:8080
app.get('/', function(req, res) {
res.sendFile(path.join(__dirname + '/index.html'));
});
//dynamically toggle to port
app.listen(port);
//log if server is on
console.log('Application loade successfully and hosted on' +port);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment