Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
17 changes: 17 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -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)'
125 changes: 125 additions & 0 deletions container-webapp-template.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
]
}