Skip to content

Commit 37edbc7

Browse files
author
Paul van Brenk
committed
Clean up the NodeJs project templates, so they work in Azure by default.
1 parent 18e959b commit 37edbc7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+99
-1468
lines changed

Nodejs/Product/Nodejs/Nodejs.csproj

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,19 +1025,12 @@
10251025
<ZipProject Include="ProjectTemplates\CloudService\ServiceConfiguration.Cloud.cscfg" />
10261026
<ZipProject Include="ProjectTemplates\CloudService\ServiceConfiguration.Local.cscfg" />
10271027
<ZipProject Include="ProjectTemplates\CloudService\ServiceDefinition.csdef" />
1028-
<ZipProject Include="ProjectTemplates\TypeScriptAzureNodejsWorkerRole\download.ps1" />
1029-
<ZipProject Include="ProjectTemplates\TypeScriptAzureNodejsWorkerRole\node.cmd" />
10301028
<ZipProject Include="ProjectTemplates\TypeScriptAzureNodejsWorkerRole\package.json" />
10311029
<ZipProject Include="ProjectTemplates\TypeScriptAzureNodejsWorkerRole\README.md" />
1032-
<ZipProject Include="ProjectTemplates\TypeScriptAzureNodejsWorkerRole\setup_worker.cmd" />
10331030
<ZipProject Include="ProjectTemplates\TypeScriptAzureNodejsWorkerRole\Worker.njsproj" />
1034-
<ZipProject Include="ProjectTemplates\TypeScriptAzureWebRole\ChangeConfig.ps1" />
1035-
<ZipProject Include="ProjectTemplates\TypeScriptAzureWebRole\download.ps1" />
10361031
<ZipProject Include="ProjectTemplates\TypeScriptAzureWebRole\iisnode.yml" />
1037-
<ZipProject Include="ProjectTemplates\TypeScriptAzureWebRole\node.cmd" />
10381032
<ZipProject Include="ProjectTemplates\TypeScriptAzureWebRole\package.json" />
10391033
<ZipProject Include="ProjectTemplates\TypeScriptAzureWebRole\README.md" />
1040-
<ZipProject Include="ProjectTemplates\TypeScriptAzureWebRole\setup_web.cmd" />
10411034
<ZipProject Include="ProjectTemplates\TypeScriptAzureWebRole\TypeScriptWebApp.njsproj" />
10421035
<ZipProject Include="ProjectTemplates\TypeScriptAzureWebRole\Web.config" />
10431036
<ZipProject Include="ProjectTemplates\TypeScriptAzureWebRole\Web.Debug.config" />
@@ -1053,12 +1046,7 @@
10531046
<ZipProject Include="ProjectTemplates\AzureExpress4App\package.json" />
10541047
<ZipProject Include="ProjectTemplates\AzureExpress4App\README.md" />
10551048
<ZipProject Include="ProjectTemplates\AzureExpress4App\main.css" />
1056-
<ZipProject Include="ProjectTemplates\AzureExpress4App\www" />
1057-
<ZipProject Include="ProjectTemplates\AzureExpress4App\ChangeConfig.ps1" />
1058-
<ZipProject Include="ProjectTemplates\AzureExpress4App\download.ps1" />
10591049
<ZipProject Include="ProjectTemplates\AzureExpress4App\iisnode.yml" />
1060-
<ZipProject Include="ProjectTemplates\AzureExpress4App\node.cmd" />
1061-
<ZipProject Include="ProjectTemplates\AzureExpress4App\setup_web.cmd" />
10621050
<ZipProject Include="ProjectTemplates\AzureExpress4App\Web.config" />
10631051
<ZipProject Include="ProjectTemplates\AzureExpress4App\Web.Debug.config" />
10641052
<ZipItem Include="Templates\Files\TypeScriptJSX\EmptyTsx.tsx" />
@@ -1075,12 +1063,10 @@
10751063
<TypeScriptProject Include="ProjectTemplates\TypeScriptExpressApp\serve-static.typings.json" />
10761064
<TypeScriptProject Include="ProjectTemplates\TypeScriptExpressApp\typings.json" />
10771065
<TypeScriptProject Include="ProjectTemplates\TypeScriptExpressApp\mine.typings.json" />
1078-
<TypeScriptProject Include="ProjectTemplates\TypeScriptExpressApp\www" />
10791066
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureExpressApp\express-serve-static-core.typings.json" />
10801067
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureExpressApp\express.typings.json" />
10811068
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureExpressApp\serve-static.typings.json" />
10821069
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureExpressApp\mine.typings.json" />
1083-
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureExpressApp\www" />
10841070
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureExpressApp\typings.json" />
10851071
<ZipItem Include="Templates\Files\EmptyJson\EmptyJson.json" />
10861072
<ZipItem Include="Templates\Files\EmptyLess\EmptyLess.less" />
@@ -1191,7 +1177,6 @@
11911177
<ZipProject Include="ProjectTemplates\Express4App\index.js" />
11921178
<ZipProject Include="ProjectTemplates\Express4App\Preview.png" />
11931179
<ZipProject Include="ProjectTemplates\Express4App\users.js" />
1194-
<ZipProject Include="ProjectTemplates\Express4App\www" />
11951180
<ZipProject Include="ProjectTemplates\AzureExpress4App\app.js" />
11961181
<ZipProject Include="ProjectTemplates\AzureExpress4App\ExpressApp.njsproj">
11971182
<SubType>Designer</SubType>
@@ -1237,11 +1222,8 @@
12371222
<ZipProject Include="ProjectTemplates\AzureNodejsWorker\Worker.vstemplate">
12381223
<SubType>Designer</SubType>
12391224
</ZipProject>
1240-
<ZipProject Include="ProjectTemplates\AzureNodejsWorker\download.ps1" />
1241-
<ZipProject Include="ProjectTemplates\AzureNodejsWorker\node.cmd" />
12421225
<ZipProject Include="ProjectTemplates\AzureNodejsWorker\package.json" />
12431226
<ZipProject Include="ProjectTemplates\AzureNodejsWorker\README.md" />
1244-
<ZipProject Include="ProjectTemplates\AzureNodejsWorker\setup_worker.cmd" />
12451227
<ZipItem Include="Templates\Files\MochaUnitTest\UnitTest.vstemplate">
12461228
<SubType>Designer</SubType>
12471229
</ZipItem>
@@ -1293,20 +1275,15 @@
12931275
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
12941276
<SubType>Designer</SubType>
12951277
</Content>
1296-
<ZipProject Include="ProjectTemplates\AzureNodejsApp\ChangeConfig.ps1" />
1297-
<ZipProject Include="ProjectTemplates\AzureNodejsApp\download.ps1" />
12981278
<ZipProject Include="ProjectTemplates\AzureNodejsApp\AzureNodejsApp.njsproj">
12991279
<SubType>Designer</SubType>
13001280
</ZipProject>
13011281
<ZipProject Include="ProjectTemplates\AzureNodejsApp\package.json" />
13021282
<ZipProject Include="ProjectTemplates\AzureNodejsApp\README.md" />
1303-
<ZipProject Include="ProjectTemplates\AzureNodejsApp\setup_web.cmd" />
13041283
<ZipProject Include="ProjectTemplates\AzureNodejsApp\Web.Debug.config">
13051284
<SubType>Designer</SubType>
13061285
</ZipProject>
13071286
<ZipProject Include="ProjectTemplates\AzureNodejsApp\Web.config" />
1308-
<ZipProject Include="ProjectTemplates\AzureNodejsApp\node.cmd" />
1309-
<ZipProject Include="ProjectTemplates\AzureNodejsApp\iisnode.yml" />
13101287
<ZipProject Include="ProjectTemplates\NodejsWebApp\NodejsWebApp.njsproj">
13111288
<SubType>Designer</SubType>
13121289
</ZipProject>
@@ -1322,6 +1299,7 @@
13221299
<SubType>Designer</SubType>
13231300
</TypeScriptProject>
13241301
<TypeScriptProject Include="ProjectTemplates\TypeScriptExpressApp\index.pug" />
1302+
<TypeScriptProject Include="ProjectTemplates\TypeScriptExpressApp\error.pug" />
13251303
<TypeScriptProject Include="ProjectTemplates\TypeScriptExpressApp\layout.pug" />
13261304
<TypeScriptProject Include="ProjectTemplates\TypeScriptExpressApp\package.json" />
13271305
<TypeScriptProject Include="ProjectTemplates\TypeScriptExpressApp\README.md" />
@@ -1331,25 +1309,18 @@
13311309
</TypeScriptProject>
13321310
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureWebApp\package.json" />
13331311
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureWebApp\README.md" />
1334-
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureWebApp\ChangeConfig.ps1" />
1335-
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureWebApp\download.ps1" />
1336-
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureWebApp\node.cmd" />
13371312
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureWebApp\Web.Debug.config" />
13381313
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureWebApp\Web.config" />
1339-
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureWebApp\setup_web.cmd" />
13401314
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureWebApp\iisnode.yml" />
13411315
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureExpressApp\TypeScriptExpressApp.njsproj">
13421316
<SubType>Designer</SubType>
13431317
</TypeScriptProject>
13441318
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureExpressApp\index.pug" />
1319+
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureExpressApp\error.pug" />
13451320
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureExpressApp\layout.pug" />
13461321
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureExpressApp\package.json" />
13471322
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureExpressApp\README.md" />
13481323
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureExpressApp\main.css" />
1349-
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureExpressApp\ChangeConfig.ps1" />
1350-
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureExpressApp\download.ps1" />
1351-
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureExpressApp\node.cmd" />
1352-
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureExpressApp\setup_web.cmd" />
13531324
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureExpressApp\Web.Debug.config" />
13541325
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureExpressApp\Web.config" />
13551326
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureExpressApp\iisnode.yml" />
@@ -1362,11 +1333,8 @@
13621333
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureNodejsWorker\Worker.vstemplate">
13631334
<SubType>Designer</SubType>
13641335
</TypeScriptProject>
1365-
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureNodejsWorker\download.ps1" />
1366-
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureNodejsWorker\node.cmd" />
13671336
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureNodejsWorker\package.json" />
13681337
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureNodejsWorker\README.md" />
1369-
<TypeScriptProject Include="ProjectTemplates\TypeScriptAzureNodejsWorker\setup_worker.cmd" />
13701338
<None Include="source.extension.vsixmanifest">
13711339
<SubType>Designer</SubType>
13721340
</None>

Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/ChangeConfig.ps1

Lines changed: 0 additions & 15 deletions
This file was deleted.

Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/ExpressApp.njsproj

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<SchemaVersion>2.0</SchemaVersion>
1111
<ProjectGuid>$guid1$</ProjectGuid>
1212
<ProjectHome>.</ProjectHome>
13-
<StartupFile>bin\www</StartupFile>
13+
<StartupFile>app.js</StartupFile>
1414
<SearchPath>
1515
</SearchPath>
1616
<WorkingDirectory>.</WorkingDirectory>
@@ -30,7 +30,6 @@
3030
<Compile Include="app.js" />
3131
<Compile Include="routes\index.js" />
3232
<Compile Include="routes\users.js" />
33-
<Compile Include="bin\www" />
3433
<Content Include="package.json" />
3534
<Content Include="public\stylesheets\main.css" />
3635
<Content Include="README.md" />
@@ -52,10 +51,6 @@ $endif$
5251
<ItemGroup>
5352
<Content Include="Web.config" />
5453
<Content Include="Web.Debug.config" />
55-
<Content Include="bin\ChangeConfig.ps1" />
56-
<Content Include="bin\download.ps1" />
57-
<Content Include="bin\setup_web.cmd" />
58-
<Content Include="bin\node.cmd" />
5954
</ItemGroup>
6055
<!-- Do not delete the following Import Project. While this appears to do nothing it is a marker for setting TypeScript properties before our import that depends on them. -->
6156
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="False" />

Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/ExpressApp.vstemplate

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,6 @@
3131
<ProjectItem>layout.pug</ProjectItem>
3232
<ProjectItem>error.pug</ProjectItem>
3333
</Folder>
34-
<Folder Name="bin">
35-
<ProjectItem ReplaceParameters="true">www</ProjectItem>
36-
<ProjectItem>ChangeConfig.ps1</ProjectItem>
37-
<ProjectItem>download.ps1</ProjectItem>
38-
<ProjectItem>setup_web.cmd</ProjectItem>
39-
<ProjectItem>node.cmd</ProjectItem>
40-
</Folder>
4134
<ProjectItem ReplaceParameters="true">Web.config</ProjectItem>
4235
<ProjectItem ReplaceParameters="true">Web.Debug.config</ProjectItem>
4336
<ProjectItem OpenInEditor="true">app.js</ProjectItem>

Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/Web.config

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
<staticContent>
1919
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
2020
</staticContent>
21-
21+
2222
<modules runAllManagedModulesForAllRequests="false" />
2323

2424
<!-- Web.Debug.config adds attributes to this to enable remote debugging when publishing in Debug configuration. -->
2525
<iisnode watchedFiles="web.config;*.js;routes\*.js;views\*.pug"/>
26-
26+
2727
<!-- Remote debugging (Azure Website with git deploy): Comment out iisnode above, and uncomment iisnode below. -->
2828
<!--<iisnode watchedFiles="web.config;*.js;routes\*.js;views\*.pug"
2929
loggingEnabled="true"
@@ -33,8 +33,8 @@
3333
<!-- indicates that the server.js file is a Node.js application
3434
to be handled by the iisnode module -->
3535
<handlers>
36-
<add name="iisnode" path="/bin/www" verb="*" modules="iisnode" />
37-
36+
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
37+
3838
<!-- Remote debugging (Azure Website with git deploy): Uncomment NtvsDebugProxy handler below.
3939
Additionally copy Microsoft.NodejsTools.WebRole to 'bin' from the Remote Debug Proxy folder.-->
4040
<!--<add name="NtvsDebugProxy" path="ntvs-debug-proxy/$guid2$" verb="*" resourceType="Unspecified"
@@ -52,23 +52,18 @@
5252
<rewrite>
5353
<rules>
5454
<clear />
55-
<!-- Remote debugging (Azure Website with git deploy): Uncomment the NtvsDebugProxy rule below. -->
56-
<!--<rule name="NtvsDebugProxy" enabled="true" stopProcessing="true">
57-
<match url="^ntvs-debug-proxy/.*"/>
58-
</rule>-->
55+
<!-- Don't interfere with requests for node-inspector debugging -->
56+
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
57+
<match url="^server.js\/debug[\/]?" />
58+
</rule>
5959

6060
<rule name="app" enabled="true" patternSyntax="ECMAScript" stopProcessing="true">
6161
<match url="iisnode.+" negate="true" />
6262
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
63-
<action type="Rewrite" url="bin\www" />
63+
<action type="Rewrite" url="app.js" />
6464
</rule>
6565
</rules>
6666
</rewrite>
6767
</system.webServer>
6868

69-
<!-- Remote debugging (Azure Website with git deploy): uncomment system.web below -->
70-
<!--<system.web>
71-
<httpRuntime targetFramework="4.5"/>
72-
<customErrors mode="Off"/>
73-
</system.web>-->
7469
</configuration>

Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/app.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,8 @@ app.use(function (err, req, res, next) {
5757
});
5858
});
5959

60+
app.set('port', process.env.PORT || 3000);
6061

61-
module.exports = app;
62+
var server = app.listen(app.get('port'), function () {
63+
debug('Express server listening on port ' + server.address().port);
64+
});

Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/download.ps1

Lines changed: 0 additions & 87 deletions
This file was deleted.

Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/node.cmd

Lines changed: 0 additions & 1 deletion
This file was deleted.

Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.0.0",
44
"private": true,
55
"scripts": {
6-
"start": "node ./bin/www"
6+
"start": "node app"
77
},
88
"description": "$projectname$",
99
"author": {
@@ -17,5 +17,8 @@
1717
"morgan": "^1.7.0",
1818
"pug": "^2.0.0-beta6",
1919
"serve-favicon": "^2.3.0"
20+
},
21+
"engines": {
22+
"node": "~6.10.x"
2023
}
2124
}

0 commit comments

Comments
 (0)