add wakey wakey
This commit is contained in:
24
WakeyWakey.cs
Normal file
24
WakeyWakey.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Azure.WebJobs;
|
||||
using Microsoft.Azure.WebJobs.Host;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace aka.terribledev.io
|
||||
{
|
||||
public static class WakeyWakey
|
||||
{
|
||||
static HttpClient client = new HttpClient();
|
||||
[FunctionName("WakeyWakey")]
|
||||
public async static Task Run([TimerTrigger("*/5 * * * *")]TimerInfo myTimer, ILogger log)
|
||||
{
|
||||
log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
|
||||
var result = await client.GetAsync("https://aka.terribledev.io");
|
||||
if(!result.IsSuccessStatusCode)
|
||||
{
|
||||
log.LogCritical("Error waking up redirect", result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,12 +34,16 @@ namespace TerribleDev
|
||||
public static class redirectFunctionTrig
|
||||
{
|
||||
[FunctionName("redirectFunctionTrig")]
|
||||
public static async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "{path}")]
|
||||
public static IActionResult Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "{path}")]
|
||||
HttpRequest req,
|
||||
ILogger log,
|
||||
string path)
|
||||
{
|
||||
var name = path.ToString().TrimEnd('/');
|
||||
if(string.Equals(name, "livecheck"))
|
||||
{
|
||||
return new OkObjectResult("Hi! ^_^");
|
||||
}
|
||||
if (!RoutesDictionary.TryGetValue(name, out string result))
|
||||
{
|
||||
return new NotFoundObjectResult("hello");
|
||||
|
||||
Reference in New Issue
Block a user