Skip to content
This repository has been archived by the owner on Aug 3, 2019. It is now read-only.

Commit

Permalink
Merge pull request #3 from tdykstra/master
Browse files Browse the repository at this point in the history
update for azure deploy button
  • Loading branch information
tdykstra committed Feb 5, 2016
2 parents 2179a46 + c5dff6b commit 1f8c554
Show file tree
Hide file tree
Showing 60 changed files with 291 additions and 10 deletions.
233 changes: 233 additions & 0 deletions azuredeploy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"siteName": {
"type": "string"
},
"hostingPlanName": {
"type": "string"
},
"siteLocation": {
"type": "string",
"allowedValues": [
"West US",
"East US",
"East US 2",
"Central US",
"South Central US",
"North Central US",
"North Europe",
"West Europe",
"East Asia",
"Southeast Asia",
"Japan West",
"Japan East",
"Brazil South",
"Australia East",
"Australia Southeast",
"Central India",
"South India",
"West India"
]
},
"sku": {
"type": "string",
"allowedValues": [
"Free",
"Shared",
"Basic",
"Standard",
"Premium"
],
"defaultValue": "Free"
},
"workerSize": {
"type": "string",
"allowedValues": [
"0",
"1",
"2"
],
"defaultValue": "0"
},
"repoUrl": {
"type": "string",
"defaultValue": "https://github.com/azure-samples/app-service-api-dotnet-todo-list.git"
},
"branch": {
"type": "string",
"defaultValue": "master"
}
},
"variables": {
"apiSiteName": "[concat(parameters('siteName'), 'API')]",
"dataApiSiteName": "[concat(parameters('siteName'), 'DataAPI')]"
},
"resources": [
{
"apiVersion": "2014-11-01",
"name": "[parameters('hostingPlanName')]",
"type": "Microsoft.Web/serverFarms",
"location": "[parameters('siteLocation')]",
"properties": {
"name": "[parameters('hostingPlanName')]",
"sku": "[parameters('sku')]",
"workerSize": "[parameters('workerSize')]",
"numberOfWorkers": 1
}
},
{
"apiVersion": "2015-04-01",
"name": "[variables('dataApiSiteName')]",
"type": "Microsoft.Web/sites",
"kind": "api",
"location": "[parameters('siteLocation')]",
"dependsOn": [
"[resourceId('Microsoft.Web/serverFarms', parameters('hostingPlanName'))]"
],
"properties": {
"serverFarmId": "[parameters('hostingPlanName')]"
},
"resources": [
{
"apiVersion": "2015-04-01",
"name": "web",
"type": "config",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('dataApiSiteName'))]"
],
"properties": {
"apiDefinition": {
"url": "[concat('https://', variables('dataApiSiteName'), '.azurewebsites.net/swagger/docs/v1')]"
}
}
},
{
"apiVersion": "2015-04-01",
"name": "appsettings",
"type": "config",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('dataApiSiteName'))]"
],
"properties": {
"PROJECT": "src\\ToDoListDataAPI\\ToDoListDataAPI.csproj"
}
},
{
"apiVersion": "2015-04-01",
"name": "web",
"type": "sourcecontrols",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('dataApiSiteName'))]",
"[resourceId('Microsoft.Web/Sites/config', variables('dataApiSiteName'), 'appsettings')]"
],
"properties": {
"RepoUrl": "[parameters('repoUrl')]",
"branch": "[parameters('branch')]",
"IsManualIntegration": true
}
}
]
},
{
"apiVersion": "2015-04-01",
"name": "[variables('apiSiteName')]",
"type": "Microsoft.Web/sites",
"kind": "api",
"location": "[parameters('siteLocation')]",
"dependsOn": [
"[resourceId('Microsoft.Web/serverFarms', parameters('hostingPlanName'))]"
],
"properties": {
"serverFarmId": "[parameters('hostingPlanName')]"
},
"resources": [
{
"apiVersion": "2015-04-01",
"name": "web",
"type": "config",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('apiSiteName'))]"
],
"properties": {
"cors": {
"allowedOrigins": [
"[concat('https://', parameters('siteName'), '.azurewebsites.net')]"
]
},
"apiDefinition": {
"url": "[concat('https://', variables('apiSiteName'), '.azurewebsites.net/swagger/docs/v1')]"
}
}
},
{
"apiVersion": "2015-04-01",
"name": "appsettings",
"type": "config",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('apiSiteName'))]"
],
"properties": {
"PROJECT": "src\\ToDoListAPI\\ToDoListAPI.csproj",
"toDoListDataAPIURL": "[concat('https://', variables('dataApiSiteName'), '.azurewebsites.net')]"
}
},
{
"apiVersion": "2015-04-01",
"name": "web",
"type": "sourcecontrols",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('apiSiteName'))]",
"[resourceId('Microsoft.Web/Sites/config', variables('apiSiteName'), 'appsettings')]"
],
"properties": {
"RepoUrl": "[parameters('repoUrl')]",
"branch": "[parameters('branch')]",
"IsManualIntegration": true
}
}
]
},
{
"apiVersion": "2015-04-01",
"name": "[parameters('siteName')]",
"type": "Microsoft.Web/sites",
"location": "[parameters('siteLocation')]",
"dependsOn": [
"[resourceId('Microsoft.Web/serverFarms', parameters('hostingPlanName'))]"
],
"properties": {
"serverFarmId": "[parameters('hostingPlanName')]"
},
"resources": [
{
"apiVersion": "2015-04-01",
"name": "appsettings",
"type": "config",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', parameters('siteName'))]"
],
"properties": {
"PROJECT": "src\\ToDoListAngular\\ToDoListAngular.csproj",
"toDoListAPIURL": "[concat('https://', variables('apiSiteName'), '.azurewebsites.net')]"
}
},
{
"apiVersion": "2015-04-01",
"name": "web",
"type": "sourcecontrols",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', parameters('siteName'))]",
"[resourceId('Microsoft.Web/Sites/config', parameters('siteName'), 'appsettings')]"
],
"properties": {
"RepoUrl": "[parameters('repoUrl')]",
"branch": "[parameters('branch')]",
"IsManualIntegration": true
}
}
]
}
]
}
10 changes: 4 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ author: bradygaster

# To Do List Azure API App Sample #

This is a simple example of how to build an [API App](http://azure.microsoft.com/en-us/documentation/articles/app-service-api-apps-why-best-platform/ "What are API Apps?") for deployment into the Azure App Service. This example API App uses a Web API middle tier, a Web API data tier, and an AngularJS client to communicate with the API.
This is a simple example that demonstrates how to build and consume [API apps](http://azure.microsoft.com/en-us/documentation/articles/app-service-api-apps-why-best-platform/ "What are API Apps?") in Azure App Service. This example application uses a Web API middle tier API app, a Web API data tier API app, and an AngularJS client web app front end.

## More Information ##
You can learn more about API Apps on the [Azure.com](http://azure.com "The Microsoft Azure Home Page") home page. This To Do List sample is used in some of the articles that explain how to create, deploy, and consume API apps.
This sample is used in the [getting-started series of tutorials for API apps](http://azure.microsoft.com/documentation/articles/app-service-api-dotnet-get-started/). These tutorials show how to use API metadata, how to configure CORS, how to configure user authentication, and how to handle internal access using an Azure Active Directory service account.

Helpful Links:
- [What are API apps](http://azure.microsoft.com/en-us/documentation/articles/app-service-api-apps-why-best-platform/ "What are API Apps?")
- [Get started with API Apps in Azure App Service](http://azure.microsoft.com/en-us/documentation/articles/app-service-dotnet-get-started/)
To deploy the application to your Azure subscription without following the tutorial, use the **Deploy to Azure** button.

[![Deploy to Azure](http://azuredeploy.net/deploybutton.png)](https://azuredeploy.net/)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class ToDoListController : ApiController

private static ToDoListDataAPI NewDataAPIClient()
{
var client = new ToDoListDataAPI(new Uri("http://localhost:45914"));
var client = new ToDoListDataAPI(new Uri(ConfigurationManager.AppSettings["toDoListDataAPIURL"]));
// Uncomment following line and entire ServicePrincipal.cs file for service principal authentication of calls to ToDoListDataAPI
//client.HttpClient.DefaultRequestHeaders.Authorization =
// new AuthenticationHeaderValue("Bearer", ServicePrincipal.GetS2SAccessTokenForProdMSA().AccessToken);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions ToDoListDataAPI/Web.config → src/ToDoListAPI/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
-->
<configuration>
<appSettings>
<add key="toDoListDataAPIURL" value="http://localhost:45914"/>
<add key="environment" value="VS Debugger"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5.2" />
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" />
Expand All @@ -57,6 +61,26 @@
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
Expand Down Expand Up @@ -87,7 +111,7 @@
<Content Include="app\views\TodoList.html" />
<Content Include="app\views\UserData.html" />
<Content Include="favicon.ico" />
<Content Include="index.html" />
<Content Include="index.cshtml" />
<Content Include="Web.config" />
</ItemGroup>
<ItemGroup>
Expand Down
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions ToDoListAngular/Web.config → src/ToDoListAngular/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
<compilation debug="true" targetFramework="4.5.2"/>
<httpRuntime targetFramework="4.5.2"/>
</system.web>
<appSettings>
<add key="toDoListAPIURL" value="http://localhost:46439"/>
<add key="environment" value="VS Debugger"/>
</appSettings>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"
Expand All @@ -18,4 +22,16 @@
warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
</compilers>
</system.codedom>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use strict';
angular.module('todoApp')
.factory('todoListSvc', ['$http', function ($http) {
//var apiEndpoint = "https://{API app name}.azurewebsites.net";
var apiEndpoint = "http://localhost:46439";

$http.defaults.useXDomain = true;
delete $http.defaults.headers.common['X-Requested-With'];
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
</head>

<body ng-app="todoApp" ng-controller="homeCtrl" role="document">

<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
Expand All @@ -31,7 +33,9 @@
</div>
</div>
</div>

<br />

<div class="container" role="main">
<div class="row">
<div class="col-xs-10 col-xs-offset-1" style="background-color:azure">
Expand All @@ -57,6 +61,9 @@ <h1>Todo List</h1>
<script src="app/scripts/homeCtrl.js"></script>
<script src="app/scripts/userDataCtrl.js"></script>
<script src="app/scripts/todoListCtrl.js"></script>
<script type="text/javascript">
var apiEndpoint = "@System.Configuration.ConfigurationManager.AppSettings["toDoListAPIURL"]";
</script>
<script src="app/scripts/todoListSvc.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net452" />
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.0" targetFramework="net452" />
<package id="Microsoft.Net.Compilers" version="1.0.0" targetFramework="net452" developmentDependency="true" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
</packages>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 1f8c554

Please sign in to comment.