Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit edae8f4

Browse filesBrowse files
committed
Added Basic Express Demo 7
1 parent fc1eaed commit edae8f4
Copy full SHA for edae8f4

File tree

Expand file treeCollapse file tree

11 files changed

+270
-0
lines changed
Filter options
Expand file treeCollapse file tree

11 files changed

+270
-0
lines changed
+97Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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)' == ''">11.0</VisualStudioVersion>
5+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
6+
<Name>07_BasicExpress</Name>
7+
<RootNamespace>07_BasicExpress</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>b1e827d8-b736-4160-af66-221ad6131b19</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+
<ProjectView>ShowAllFiles</ProjectView>
23+
<NodejsPort>1337</NodejsPort>
24+
<StartWebBrowser>true</StartWebBrowser>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
27+
<DebugSymbols>true</DebugSymbols>
28+
</PropertyGroup>
29+
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
30+
<DebugSymbols>true</DebugSymbols>
31+
</PropertyGroup>
32+
<ItemGroup>
33+
<Compile Include="app.js" />
34+
<Compile Include="routes\index.js" />
35+
<Compile Include="routes\user.js" />
36+
<Content Include="package.json" />
37+
<Content Include="public\stylesheets\style.styl" />
38+
<Content Include="views\index.jade" />
39+
<Content Include="views\layout.jade" />
40+
</ItemGroup>
41+
<ItemGroup>
42+
<Folder Include="bin\" />
43+
<Folder Include="public\" />
44+
<Folder Include="public\images\" />
45+
<Folder Include="public\javascripts\" />
46+
<Folder Include="public\stylesheets\" />
47+
<Folder Include="routes\" />
48+
<Folder Include="views\" />
49+
</ItemGroup>
50+
<ItemGroup>
51+
<Content Include="Web.config" />
52+
<Content Include="Web.Debug.config" />
53+
<Content Include="bin\ChangeConfig.ps1" />
54+
<Content Include="bin\download.ps1" />
55+
<Content Include="bin\setup_web.cmd" />
56+
<Content Include="bin\node.cmd" />
57+
</ItemGroup>
58+
<Import Project="$(VSToolsPath)\Node.js Tools\Microsoft.NodejsTools.targets" />
59+
<ProjectExtensions>
60+
<VisualStudio>
61+
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
62+
<WebProjectProperties>
63+
<UseIIS>False</UseIIS>
64+
<AutoAssignPort>True</AutoAssignPort>
65+
<DevelopmentServerPort>0</DevelopmentServerPort>
66+
<DevelopmentServerVPath>/</DevelopmentServerVPath>
67+
<IISUrl>http://localhost:48022/</IISUrl>
68+
<NTLMAuthentication>False</NTLMAuthentication>
69+
<UseCustomServer>True</UseCustomServer>
70+
<CustomServerUrl>http://localhost:1337</CustomServerUrl>
71+
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
72+
</WebProjectProperties>
73+
</FlavorProperties>
74+
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}" User="">
75+
<WebProjectProperties>
76+
<StartPageUrl>
77+
</StartPageUrl>
78+
<StartAction>CurrentPage</StartAction>
79+
<AspNetDebugging>True</AspNetDebugging>
80+
<SilverlightDebugging>False</SilverlightDebugging>
81+
<NativeDebugging>False</NativeDebugging>
82+
<SQLDebugging>False</SQLDebugging>
83+
<ExternalProgram>
84+
</ExternalProgram>
85+
<StartExternalURL>
86+
</StartExternalURL>
87+
<StartCmdLineArguments>
88+
</StartCmdLineArguments>
89+
<StartWorkingDirectory>
90+
</StartWorkingDirectory>
91+
<EnableENC>False</EnableENC>
92+
<AlwaysStartWebServerOnDebug>False</AlwaysStartWebServerOnDebug>
93+
</WebProjectProperties>
94+
</FlavorProperties>
95+
</VisualStudio>
96+
</ProjectExtensions>
97+
</Project>

‎07_BasicExpress/Web.Debug.config

Copy file name to clipboard
+39Lines 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+
interceptor="--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/3ee9d282-698b-4819-9f3e-70f501d05201" 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>

‎07_BasicExpress/Web.config

Copy file name to clipboard
+43Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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"/>
26+
27+
<!-- indicates that the server.js file is a Node.js application
28+
to be handled by the iisnode module -->
29+
<handlers>
30+
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
31+
</handlers>
32+
<rewrite>
33+
<rules>
34+
<clear />
35+
<rule name="app" enabled="true" patternSyntax="ECMAScript" stopProcessing="true">
36+
<match url="iisnode.+" negate="true" />
37+
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
38+
<action type="Rewrite" url="app.js" />
39+
</rule>
40+
</rules>
41+
</rewrite>
42+
</system.webServer>
43+
</configuration>

‎07_BasicExpress/app.js

Copy file name to clipboard
+37Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+

2+
/**
3+
* Module dependencies.
4+
*/
5+
6+
var express = require('express');
7+
var routes = require('./routes');
8+
var user = require('./routes/user');
9+
var http = require('http');
10+
var path = require('path');
11+
12+
var app = express();
13+
14+
// all environments
15+
app.set('port', process.env.PORT || 3000);
16+
app.set('views', path.join(__dirname, 'views'));
17+
app.set('view engine', 'jade');
18+
app.use(express.favicon());
19+
app.use(express.logger('dev'));
20+
app.use(express.json());
21+
app.use(express.urlencoded());
22+
app.use(express.methodOverride());
23+
app.use(app.router);
24+
app.use(require('stylus').middleware(path.join(__dirname, 'public')));
25+
app.use(express.static(path.join(__dirname, 'public')));
26+
27+
// development only
28+
if ('development' == app.get('env')) {
29+
app.use(express.errorHandler());
30+
}
31+
32+
app.get('/', routes.index);
33+
app.get('/users', user.list);
34+
35+
http.createServer(app).listen(app.get('port'), function () {
36+
console.log('Express server listening on port ' + app.get('port'));
37+
});

‎07_BasicExpress/package.json

Copy file name to clipboard
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "_07_BasicExpress",
3+
"version": "0.0.0",
4+
"description": "07_BasicExpress",
5+
"main": "app.js",
6+
"author": {
7+
"name": "Rami Sayar",
8+
"email": ""
9+
},
10+
"dependencies": {
11+
"express": "3.4.4",
12+
"jade": "*",
13+
"stylus": "*"
14+
}
15+
}
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
body
2+
padding: 50px
3+
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif
4+
a
5+
color: #00B7FF

‎07_BasicExpress/routes/index.js

Copy file name to clipboard
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+

2+
/*
3+
* GET home page.
4+
*/
5+
6+
exports.index = function (req, res) {
7+
res.render('index', { title: 'Express' });
8+
};

‎07_BasicExpress/routes/user.js

Copy file name to clipboard
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+

2+
/*
3+
* GET users listing.
4+
*/
5+
6+
exports.list = function (req, res) {
7+
res.send("respond with a resource");
8+
};

‎07_BasicExpress/views/index.jade

Copy file name to clipboard
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
extends layout
2+
3+
block content
4+
h1= title
5+
p Welcome to #{title}

‎07_BasicExpress/views/layout.jade

Copy file name to clipboard
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
doctype html
2+
html
3+
head
4+
title= title
5+
link(rel='stylesheet', href='/stylesheets/style.css')
6+
body
7+
block content

‎NodeMVA.sln

Copy file name to clipboardExpand all lines: NodeMVA.sln
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "05_HelloWorldTCP", "05_Hell
2121
EndProject
2222
Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "06_Streams", "06_Streams\06_Streams.njsproj", "{4D797A54-38F8-4DCC-86E4-24C349D58EB5}"
2323
EndProject
24+
Project("{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}") = "07_BasicExpress", "07_BasicExpress\07_BasicExpress.njsproj", "{B1E827D8-B736-4160-AF66-221AD6131B19}"
25+
EndProject
2426
Global
2527
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2628
Debug|Any CPU = Debug|Any CPU
@@ -51,6 +53,10 @@ Global
5153
{4D797A54-38F8-4DCC-86E4-24C349D58EB5}.Debug|Any CPU.Build.0 = Debug|Any CPU
5254
{4D797A54-38F8-4DCC-86E4-24C349D58EB5}.Release|Any CPU.ActiveCfg = Release|Any CPU
5355
{4D797A54-38F8-4DCC-86E4-24C349D58EB5}.Release|Any CPU.Build.0 = Release|Any CPU
56+
{B1E827D8-B736-4160-AF66-221AD6131B19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
57+
{B1E827D8-B736-4160-AF66-221AD6131B19}.Debug|Any CPU.Build.0 = Debug|Any CPU
58+
{B1E827D8-B736-4160-AF66-221AD6131B19}.Release|Any CPU.ActiveCfg = Release|Any CPU
59+
{B1E827D8-B736-4160-AF66-221AD6131B19}.Release|Any CPU.Build.0 = Release|Any CPU
5460
EndGlobalSection
5561
GlobalSection(SolutionProperties) = preSolution
5662
HideSolutionNode = FALSE

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.