Skip to content

Instantly share code, notes, and snippets.

@hellobrian
Last active August 29, 2015 14:13
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 hellobrian/9c5557e3055e83681035 to your computer and use it in GitHub Desktop.
Save hellobrian/9c5557e3055e83681035 to your computer and use it in GitHub Desktop.
bluemix server.js express
// Import Node module packages
var express = require('express');
// Invoke express app
var app = express();
// place static web files in public folder
// __dirname is a node.js is a contant for the current directory
app.use(express.static(__dirname + '/public', { extensions: ['html'] }));
// Search for the proper HOST and PORT to serve this app
var host = (process.env.VCAP_APP_HOST || 'localhost');
var port = (process.env.VCAP_APP_PORT || 3000);
// Listen for web requests
app.listen(port, host);
console.log('App started on port ' + port);
@hellobrian
Copy link
Author

$ brew tap pivotal/tap
$ brew install cloudfoundry-cli

@hellobrian
Copy link
Author

cf push my_app -c "node server.js" -m 64m

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment