-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Large number of changes throughout including: - Port code to dotnet 5 - Adding BasicAuth option - Adding POST to the previous GET calls - Removing version drafter GitHub Action - Removing unused Azure DevOps YML build pipelines - Removing the GitHub Action temporarily - Adding a Deploy to Azure button.
- Loading branch information
Showing
16 changed files
with
294 additions
and
186 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | ||
"contentVersion": "1.0.0.1", | ||
"parameters": { | ||
"siteName": { | ||
"type": "string", | ||
"defaultValue": "[concat('WebApp-', uniqueString(resourceGroup().id))]", | ||
"metadata": { | ||
"description": "The name of the WebApp/ApiApp being deployed" | ||
} | ||
}, | ||
"location": { | ||
"type": "string", | ||
"defaultValue": "[resourceGroup().location]", | ||
"metadata": { | ||
"description": "Location for all resources." | ||
} | ||
}, | ||
"sku": { | ||
"type": "string", | ||
"allowedValues": [ | ||
"F1", | ||
"D1", | ||
"B1", | ||
"B2", | ||
"B3", | ||
"S1", | ||
"S2", | ||
"S3", | ||
"P1", | ||
"P2", | ||
"P3", | ||
"P4" | ||
], | ||
"defaultValue": "F1", | ||
"metadata": { | ||
"description": "The pricing tier for the hosting plan." | ||
} | ||
}, | ||
"workerSize": { | ||
"type": "string", | ||
"allowedValues": [ | ||
"0", | ||
"1", | ||
"2" | ||
], | ||
"defaultValue": "0", | ||
"metadata": { | ||
"description": "The instance size of the hosting plan (small, medium, or large)." | ||
} | ||
}, | ||
"repoURL": { | ||
"type": "string", | ||
"defaultValue": "https://github.com/joelbyford/QrCodeApiApp.git", | ||
"metadata": { | ||
"description": "The URL for the GitHub repository *CHANGE IF YOU HAVE FORKED THIS REPO*." | ||
} | ||
}, | ||
"branch": { | ||
"type": "string", | ||
"defaultValue": "master", | ||
"metadata": { | ||
"description": "The branch of the GitHub repository to use." | ||
} | ||
} | ||
}, | ||
"variables": { | ||
"hostingPlanName": "[concat('hpn-', resourceGroup().name)]" | ||
}, | ||
"resources": [ | ||
{ | ||
"type": "Microsoft.Web/serverfarms", | ||
"apiVersion": "2020-06-01", | ||
"name": "[variables('hostingPlanName')]", | ||
"location": "[parameters('location')]", | ||
"sku": { | ||
"name": "[parameters('sku')]", | ||
"capacity": "[parameters('workerSize')]" | ||
}, | ||
"properties": { | ||
"name": "[variables('hostingPlanName')]" | ||
} | ||
}, | ||
{ | ||
"type": "Microsoft.Web/sites", | ||
"apiVersion": "2020-06-01", | ||
"name": "[parameters('siteName')]", | ||
"location": "[parameters('location')]", | ||
"dependsOn": [ | ||
"[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]" | ||
], | ||
"properties": { | ||
"serverFarmId": "[variables('hostingPlanName')]" | ||
}, | ||
"resources": [ | ||
{ | ||
"type": "sourcecontrols", | ||
"apiVersion": "2020-06-01", | ||
"name": "web", | ||
"location": "[parameters('location')]", | ||
"dependsOn": [ | ||
"[resourceId('Microsoft.Web/sites', parameters('siteName'))]" | ||
], | ||
"properties": { | ||
"repoUrl": "[parameters('repoURL')]", | ||
"branch": "[parameters('branch')]", | ||
"isManualIntegration": true | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
using Microsoft.Net.Http.Headers; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.Formatters; | ||
|
||
namespace QrCodeApiApp | ||
{ | ||
|
||
// Thanks to https://github.com/RickStrahl/AspNetCoreRawRequestSample for the starting example here. | ||
public class TxtInputFormatter : InputFormatter | ||
{ | ||
public TxtInputFormatter() | ||
{ | ||
SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/plain")); | ||
} | ||
|
||
//Accept text/plain and text/csv only | ||
public override Boolean CanRead(InputFormatterContext context) | ||
{ | ||
if (context == null) throw new ArgumentNullException(nameof(context)); | ||
|
||
var contentType = context.HttpContext.Request.ContentType; | ||
|
||
if (contentType == "text/plain") | ||
return true; | ||
else | ||
return false; | ||
} | ||
|
||
// handle the raw text input | ||
public override async Task<InputFormatterResult> ReadRequestBodyAsync(InputFormatterContext context) | ||
{ | ||
var request = context.HttpContext.Request; | ||
var contentType = context.HttpContext.Request.ContentType; | ||
|
||
|
||
if (contentType == "text/plain") | ||
{ | ||
using (var reader = new StreamReader(request.Body)) | ||
{ | ||
var content = await reader.ReadToEndAsync(); | ||
return await InputFormatterResult.SuccessAsync(content); | ||
} | ||
} | ||
|
||
return await InputFormatterResult.FailureAsync(); | ||
} | ||
} | ||
} |
Oops, something went wrong.