Last active
August 29, 2015 14:13
-
-
Save hellobrian/9c5557e3055e83681035 to your computer and use it in GitHub Desktop.
bluemix server.js express
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
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
$ brew tap pivotal/tap
$ brew install cloudfoundry-cli