Skip to content
This repository was archived by the owner on Jun 14, 2024. It is now read-only.

Commit 4a28b3e

Browse files
author
Chandra Pratap
authored
initial commit (#277)
1 parent 7331c57 commit 4a28b3e

30 files changed

+11537
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM node:8
2+
LABEL maintainer="Azure App Services Container Images <[email protected]>"
3+
4+
# Create app directory
5+
WORKDIR /app
6+
7+
# Bundle app source
8+
COPY . .
9+
RUN npm install
10+
11+
EXPOSE 3000 80
12+
CMD [ "npm", "start" ]
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- This file will modify Web.config to enable remote debugging when publishing your project in the Debug configuration.
3+
For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
4+
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
5+
6+
<system.web xdt:Transform="Insert">
7+
<httpRuntime targetFramework="4.5" />
8+
<customErrors mode="Off"/>
9+
</system.web>
10+
11+
<system.webServer>
12+
<!-- mimeMap enables IIS to serve particular file types as specified by fileExtension. -->
13+
<staticContent>
14+
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
15+
</staticContent>
16+
17+
<iisnode loggingEnabled="true"
18+
devErrorsEnabled="true"
19+
nodeProcessCommandLine="node.exe --debug"
20+
xdt:Transform="SetAttributes" />
21+
22+
<handlers>
23+
<!-- The GUID in the following path is meant to protect the debugging endpoint against inadvertent access, and should be treated as a password. -->
24+
<add name="NtvsDebugProxy" path="ntvs-debug-proxy/59ea9a82-a297-477d-86ba-dfc8c5f4801e" verb="*" resourceType="Unspecified"
25+
type="Microsoft.NodejsTools.Debugger.WebSocketProxy, Microsoft.NodejsTools.WebRole"
26+
xdt:Transform="Insert" />
27+
</handlers>
28+
29+
<rewrite>
30+
<rules>
31+
<rule name="NtvsDebugProxy" enabled="true" stopProcessing="true" xdt:Transform="InsertAfter(/configuration/system.webServer/rewrite/rules/clear)">
32+
<match url="^ntvs-debug-proxy/.*"/>
33+
</rule>
34+
</rules>
35+
</rewrite>
36+
37+
</system.webServer>
38+
39+
</configuration>
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
For more information on how to configure your Node.js application, please visit
4+
http://go.microsoft.com/fwlink/?LinkId=290972
5+
-->
6+
<configuration>
7+
<appSettings>
8+
<!--
9+
<add key="StorageAccountName" value="" />
10+
<add key="StorageAccountKey" value="" />
11+
<add key="ServiceBusNamespace" value="" />
12+
<add key="ServiceBusIssuerName" value="" />
13+
<add key="ServiceBusIssuerSecretKey" value="" />
14+
-->
15+
</appSettings>
16+
<system.webServer>
17+
<!-- mimeMap enables IIS to serve particular file types as specified by fileExtension. -->
18+
<staticContent>
19+
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
20+
</staticContent>
21+
22+
<modules runAllManagedModulesForAllRequests="false" />
23+
24+
<!-- Web.Debug.config adds attributes to this to enable remote debugging when publishing in Debug configuration. -->
25+
<iisnode watchedFiles="web.config;*.js;routes\*.js;views\*.pug"/>
26+
27+
<!-- Remote debugging (Azure Website with git deploy): Comment out iisnode above, and uncomment iisnode below. -->
28+
<!--<iisnode watchedFiles="web.config;*.js;routes\*.js;views\*.pug"
29+
loggingEnabled="true"
30+
devErrorsEnabled="true"
31+
nodeProcessCommandLine="node.exe &#45;&#45;debug"/>-->
32+
33+
<!-- indicates that the server.js file is a Node.js application
34+
to be handled by the iisnode module -->
35+
<handlers>
36+
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
37+
38+
<!-- Remote debugging (Azure Website with git deploy): Uncomment NtvsDebugProxy handler below.
39+
Additionally copy Microsoft.NodejsTools.WebRole to 'bin' from the Remote Debug Proxy folder.-->
40+
<!--<add name="NtvsDebugProxy" path="ntvs-debug-proxy/59ea9a82-a297-477d-86ba-dfc8c5f4801e" verb="*" resourceType="Unspecified"
41+
type="Microsoft.NodejsTools.Debugger.WebSocketProxy, Microsoft.NodejsTools.WebRole"/>-->
42+
</handlers>
43+
44+
<security>
45+
<requestFiltering>
46+
<hiddenSegments>
47+
<remove segment="bin" />
48+
</hiddenSegments>
49+
</requestFiltering>
50+
</security>
51+
52+
<rewrite>
53+
<rules>
54+
<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>-->
59+
60+
<!-- Don't interfere with requests for node-inspector debugging -->
61+
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
62+
<match url="^server.js\/debug[\/]?" />
63+
</rule>
64+
65+
<rule name="app" enabled="true" patternSyntax="ECMAScript" stopProcessing="true">
66+
<match url="iisnode.+" negate="true" />
67+
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
68+
<action type="Rewrite" url="app.js" />
69+
</rule>
70+
</rules>
71+
</rewrite>
72+
</system.webServer>
73+
74+
<!-- Remote debugging (Azure Website with git deploy): uncomment system.web below -->
75+
<!--<system.web>
76+
<httpRuntime targetFramework="4.5"/>
77+
<customErrors mode="Off"/>
78+
</system.web>-->
79+
</configuration>
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
'use strict';
2+
var debug = require('debug');
3+
var express = require('express');
4+
var path = require('path');
5+
var favicon = require('serve-favicon');
6+
var logger = require('morgan');
7+
var cookieParser = require('cookie-parser');
8+
var bodyParser = require('body-parser');
9+
10+
var routes = require('./routes/index');
11+
var users = require('./routes/users');
12+
13+
var appInsights = require('applicationinsights');
14+
if(process.env.NODE_ENV == "production"){
15+
appInsights.setup();
16+
appInsights.start();
17+
}
18+
19+
var server;
20+
var app = express();
21+
22+
// view engine setup
23+
app.set('views', path.join(__dirname, 'views'));
24+
app.set('view engine', 'pug');
25+
26+
// uncomment after placing your favicon in /public
27+
//app.use(favicon(__dirname + '/public/favicon.ico'));
28+
app.use(logger('dev'));
29+
app.use(bodyParser.json());
30+
app.use(bodyParser.urlencoded({ extended: false }));
31+
app.use(cookieParser());
32+
app.use(express.static(path.join(__dirname, 'public')));
33+
34+
app.use('/', routes);
35+
app.use('/users', users);
36+
37+
// catch 404 and forward to error handler
38+
app.use(function (req, res, next) {
39+
var err = new Error('Not Found');
40+
err.status = 404;
41+
next(err);
42+
});
43+
44+
// error handlers
45+
46+
// development error handler
47+
// will print stacktrace
48+
if (app.get('env') === 'development') {
49+
app.use(function (err, req, res, next) {
50+
res.status(err.status || 500);
51+
res.render('error', {
52+
message: err.message,
53+
error: err
54+
});
55+
});
56+
}
57+
58+
// production error handler
59+
// no stacktraces leaked to user
60+
app.use(function (err, req, res, next) {
61+
res.status(err.status || 500);
62+
res.render('error', {
63+
message: err.message,
64+
error: {}
65+
});
66+
});
67+
68+
app.set('port', process.env.PORT || 3000);
69+
70+
exports.listen = function () {
71+
server = app.listen(app.get('port'), function () {
72+
debug('Express server listening on port ' + server.address().port);
73+
});
74+
}
75+
76+
exports.close = function () {
77+
server.close(() => {
78+
debug('Server stopped.');
79+
});
80+
}
81+
82+
this.listen();
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
3+
<PropertyGroup>
4+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
5+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
6+
<Name>nodejs-webapp-express</Name>
7+
<RootNamespace>nodejs-webapp-express</RootNamespace>
8+
</PropertyGroup>
9+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
10+
<PropertyGroup>
11+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
12+
<SchemaVersion>2.0</SchemaVersion>
13+
<ProjectGuid>9e362718-6538-43f7-bc4a-114f9e9c1f5a</ProjectGuid>
14+
<ProjectHome>.</ProjectHome>
15+
<StartupFile>app.js</StartupFile>
16+
<SearchPath>
17+
</SearchPath>
18+
<WorkingDirectory>.</WorkingDirectory>
19+
<OutputPath>.</OutputPath>
20+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
21+
<ProjectTypeGuids>{3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{349c5851-65df-11da-9384-00065b846f21};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}</ProjectTypeGuids>
22+
<NodejsPort>1337</NodejsPort>
23+
<StartWebBrowser>true</StartWebBrowser>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
26+
<DebugSymbols>true</DebugSymbols>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
29+
<DebugSymbols>true</DebugSymbols>
30+
</PropertyGroup>
31+
<ItemGroup>
32+
<Compile Include="app.js" />
33+
<Compile Include="routes\index.js" />
34+
<Compile Include="routes\users.js" />
35+
<Content Include="package.json" />
36+
<Content Include="public\fonts\segoeuil.ttf" />
37+
<Content Include="public\images\successCloudNew.svg" />
38+
<Content Include="public\images\tweetThis.svg" />
39+
<Content Include="public\stylesheets\bootstrap.css" />
40+
<Content Include="public\stylesheets\bootstrap.min.css" />
41+
<Content Include="public\stylesheets\style.css" />
42+
<Content Include="README.md" />
43+
<Content Include="views\index.pug" />
44+
<Content Include="views\layout.pug" />
45+
<Content Include="views\error.pug" />
46+
</ItemGroup>
47+
<ItemGroup>
48+
<Folder Include="public\" />
49+
<Folder Include="public\fonts\" />
50+
<Folder Include="public\images\" />
51+
<Folder Include="public\stylesheets\" />
52+
<Folder Include="routes\" />
53+
<Folder Include="views\" />
54+
</ItemGroup>
55+
<ItemGroup>
56+
<Content Include="Web.config" />
57+
<Content Include="Web.Debug.config" />
58+
</ItemGroup>
59+
<!-- 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. -->
60+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="False" />
61+
<Import Project="$(VSToolsPath)\Node.js Tools\Microsoft.NodejsTools.targets" />
62+
<ProjectExtensions>
63+
<VisualStudio>
64+
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
65+
<WebProjectProperties>
66+
<UseIIS>False</UseIIS>
67+
<AutoAssignPort>True</AutoAssignPort>
68+
<DevelopmentServerPort>0</DevelopmentServerPort>
69+
<DevelopmentServerVPath>/</DevelopmentServerVPath>
70+
<IISUrl>http://localhost:48022/</IISUrl>
71+
<NTLMAuthentication>False</NTLMAuthentication>
72+
<UseCustomServer>True</UseCustomServer>
73+
<CustomServerUrl>http://localhost:1337</CustomServerUrl>
74+
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
75+
</WebProjectProperties>
76+
</FlavorProperties>
77+
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}" User="">
78+
<WebProjectProperties>
79+
<StartPageUrl>
80+
</StartPageUrl>
81+
<StartAction>CurrentPage</StartAction>
82+
<AspNetDebugging>True</AspNetDebugging>
83+
<SilverlightDebugging>False</SilverlightDebugging>
84+
<NativeDebugging>False</NativeDebugging>
85+
<SQLDebugging>False</SQLDebugging>
86+
<ExternalProgram>
87+
</ExternalProgram>
88+
<StartExternalURL>
89+
</StartExternalURL>
90+
<StartCmdLineArguments>
91+
</StartCmdLineArguments>
92+
<StartWorkingDirectory>
93+
</StartWorkingDirectory>
94+
<EnableENC>False</EnableENC>
95+
<AlwaysStartWebServerOnDebug>False</AlwaysStartWebServerOnDebug>
96+
</WebProjectProperties>
97+
</FlavorProperties>
98+
</VisualStudio>
99+
</ProjectExtensions>
100+
</Project>

0 commit comments

Comments
 (0)