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
$mysql_config = $services["mysql-5.1"][0]["credentials"]; | |
$db = mysql_connect( $mysql_config["hostname"], | |
$mysql_config["username"], | |
$mysql_config["password"]); | |
mysql_select_db( $mysql_config["name"] ); |
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
<html> | |
<head> | |
<title>Demo</title> | |
</head> | |
<body> | |
<h1>PHP Mongo Test</h1> | |
<?php | |
$services = getenv("VCAP_SERVICES"); | |
echo "<h2>VCAP_SERVICES</h2>"; | |
echo "<p>" . $services . "</p>"; |
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
$services = json_decode(getenv("VCAP_SERVICES"),true); |
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
var http = require('http'); | |
http.createServer(function (req, res) { | |
res.end("Hello, world!"); | |
}).listen( process.env.VCAP_APP_PORT || 8001 ); |
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
var http = require('http'); | |
http.createServer(function (req, res) { | |
res.end("This is a gist app!"); | |
}).listen( process.env.VCAP_APP_PORT); |
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
source 'http://rubygems.org' | |
gem 'sinatra' | |
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
<?php echo "Hello" ?> |
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
<h1>Test MySQL Connection</h1> | |
<?php | |
$services = getenv("VCAP_SERVICES"); | |
$services_json = json_decode($services,true); | |
$mysql_config = $services_json["mysql-5.1"][0]["credentials"]; | |
// ** MySQL settings from resource descriptor ** // | |
$username = $mysql_config["username"]; |
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
var connect = require('connect'), | |
fs = require('fs'); | |
var serve_html = function(root) { | |
return function(req,res,next) { | |
var path = root + req.url + '.html'; | |
fs.stat(path,function(err,stat) { | |
if (!err && !stat.isDirectory()) { | |
res.statusCode = 301; | |
res.setHeader('Location', req.url + '.html'); |
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
var connect = require('connect'), | |
mongodb = require('mongodb'); | |
var showDBInfo = function(req,res) { | |
res.end("You are connected to the database"); | |
}; | |
var noDatabaseError = function(res) { | |
res.statusCode = 500; | |
res.end("Unable to connect to database"); |
OlderNewer