Skip to content

Instantly share code, notes, and snippets.

@SyntaxC4
Created July 26, 2012 07:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SyntaxC4/3180793 to your computer and use it in GitHub Desktop.
Save SyntaxC4/3180793 to your computer and use it in GitHub Desktop.
Accessing Portal Set App Settings from PHP and Node.js
<html>
<head><title>Accessing App Settings from PHP</title></head>
<body>
<h1>Hello from <?php echo getenv("CloudProvider"); ?></h1>
<ul>
<li><label>Service Bus Namespace:</label> <?php echo getenv("ServiceBusConnectionString"); ?></li>
<li><label>Storage Connection String:</label> <?php echo getenv("StorageConnectionString"); ?>
</ul>
<p>Happy Clouding!</p>
<p><?php echo getenv("Developer"); ?></p>
</body>
</html>
{
"name": "HelloWorld",
"version": "0.0.1",
"description": "",
"main": "./server.js",
"engines": { "node": ">= 0.6.0" }
}
var http = require('http');
var port = process.env.port || 1337;
http.createServer(function(req, res) {
res.write('<p>Hello from ' + process.env.CloudProvider +' </p>');
res.write('<ul>');
res.write('<li><label>Service Bus Namespace:</label>'+ process.env.ServiceBusConnectionString +' </li>');
res.write('<li><label>Storage Connection String:</label>'+ process.env.StorageConnectionString +' </li>');
res.write('</ul>');
res.write('<p>Happy Clouding!</p>');
res.end('<p>'+ process.env.Developer +'</p>');
}).listen(port);
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="false" />
<!-- indicates that the server.js file is a node.js application
to be handled by the iisnode module -->
<handlers>
<add name="iisnode" path="server.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<clear />
<rule name="app" enabled="true" patternSyntax="ECMAScript" stopProcessing="true">
<match url="server\.js.+" negate="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="server.js" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment