diff --git a/README.md b/README.md index 8b78c83..51adaae 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # Beautiful REST API design with ASP.NET Core and Ion + Hello! :wave: This repository contains an example API written in C# and ASP.NET Core 1.1. It uses the [Ion hypermedia specification][ion] as a starting point to model a consistent, clean REST API that embraces HATEOAS. I use this example in my talk [Building beautiful RESTful APIs with ASP.NET Core](https://speakerdeck.com/nbarbettini/building-beautiful-rest-apis-in-asp-dot-net-core) (follow the link to download the slides). diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..d6f40c5 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,17 @@ +# ASP.NET Core +# Build and test ASP.NET Core projects targeting .NET Core. +# Add steps that run tests, create a NuGet package, deploy, and more: +# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core + +trigger: +- master + +pool: + vmImage: 'Ubuntu-16.04' + +variables: + buildConfiguration: 'Release' + +steps: +- script: dotnet build --configuration $(buildConfiguration) + displayName: 'dotnet build $(buildConfiguration)' diff --git a/container-webapp-template.json b/container-webapp-template.json new file mode 100644 index 0000000..02e3c57 --- /dev/null +++ b/container-webapp-template.json @@ -0,0 +1,125 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "webAppName": { + "type": "String" + }, + "hostingPlanName": { + "type": "String" + }, + "appInsightsLocation": { + "type": "String" + }, + "sku": { + "defaultValue": "Standard", + "type": "String" + }, + "registryName": { + "type": "String" + }, + "imageName": { + "type":"String" + }, + "registryLocation": { + "type": "String" + }, + "registrySku": { + "defaultValue": "Standard", + "type": "String" + }, + "startupCommand": { + "defaultValue": "", + "type": "String" + } + }, + "resources": [ + { + "type": "Microsoft.Web/sites", + "name": "[parameters('webAppName')]", + "apiVersion": "2016-03-01", + "location": "[resourceGroup().location]", + "tags": { + "[concat('hidden-related:', '/subscriptions/', subscription().subscriptionId,'/resourcegroups/', resourceGroup().name, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "empty" + }, + "properties": { + "name": "[parameters('webAppName')]", + "siteConfig": { + "appSettings": [ + { + "name": "DOCKER_REGISTRY_SERVER_URL", + "value": "[concat('https://', reference(concat('Microsoft.ContainerRegistry/registries/', parameters('registryName'))).loginServer)]" + }, + { + "name": "DOCKER_REGISTRY_SERVER_USERNAME", + "value": "[listCredentials(concat('Microsoft.ContainerRegistry/registries/', parameters('registryName')), '2017-10-01').username]" + }, + { + "name": "DOCKER_REGISTRY_SERVER_PASSWORD", + "value": "[listCredentials(concat('Microsoft.ContainerRegistry/registries/', parameters('registryName')), '2017-10-01').passwords[0].value]" + }, + { + "name": "WEBSITES_ENABLE_APP_SERVICE_STORAGE", + "value": "false" + }, + { + "name": "APPINSIGHTS_INSTRUMENTATIONKEY", + "value": "[reference(resourceId('microsoft.insights/components/', parameters('webAppName')), '2015-05-01').InstrumentationKey]" + } + ], + "appCommandLine": "[parameters('startupCommand')]", + "linuxFxVersion": "[concat('DOCKER|', reference(concat('Microsoft.ContainerRegistry/registries/', parameters('registryName'))).loginServer, '/', parameters('imageName'))]" + }, + "serverFarmId": "[concat('/subscriptions/', subscription().subscriptionId,'/resourcegroups/', resourceGroup().name, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]", + "hostingEnvironment": "" + }, + "dependsOn": [ + "[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]", + "[resourceId('microsoft.insights/components/', parameters('webAppName'))]" + ] + }, + { + "type": "Microsoft.ContainerRegistry/registries", + "sku": { + "name": "[parameters('registrySku')]" + }, + "name": "[parameters('registryName')]", + "apiVersion": "2017-10-01", + "location": "[parameters('registryLocation')]", + "properties": { + "adminUserEnabled": "true" + } + }, + { + "type": "Microsoft.Web/serverfarms", + "sku": { + "Tier": "[first(skip(split(parameters('sku'), ' '), 1))]", + "Name": "[first(split(parameters('sku'), ' '))]" + }, + "kind": "linux", + "name": "[parameters('hostingPlanName')]", + "apiVersion": "2016-09-01", + "location": "[resourceGroup().location]", + "properties": { + "name": "[parameters('hostingPlanName')]", + "workerSizeId": "0", + "reserved": true, + "numberOfWorkers": "1", + "hostingEnvironment": "" + } + }, + { + "type": "Microsoft.Insights/components", + "name": "[parameters('webAppName')]", + "apiVersion": "2014-04-01", + "location": "[parameters('appInsightsLocation')]", + "tags": { + "[concat('hidden-link:', resourceGroup().id, '/providers/Microsoft.Web/sites/', parameters('webAppName'))]": "Resource" + }, + "properties": { + "applicationId": "[parameters('webAppName')]", + "Request_Source": "AzureTfsExtensionAzureProject" + } + } + ] +} \ No newline at end of file