public IActionResult HttpHealthCheck( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "health")] HttpRequest req, ILogger log) { log.LogWarning("Health check hit. This should be logged."); var timestamp = _timestamps.Now(); return(new OkObjectResult(new { timestamp })); }
public IActionResult PingHttpTrigger( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "ping")] HttpRequest req) { var now = _timestamps.Now(); // DI Resolution Exception Here, when using ServiceProvider var serviceInstance = DI.Services.BuildServiceProvider().GetService <ITimestampService>() as ITimestampService; return(new OkObjectResult(new { timestamp = now })); }
public async Task <IActionResult> HttpCreateJob( [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "jobs")] HttpRequestMessage req, [DurableClient] IDurableClient durableClient, ILogger log) { var job = await req.Content.ReadAsAsync <BackgroundJob>(); job.CreatedAt = _timestamps.Now(); job.Id = await durableClient.StartNewAsync(nameof(BackgroundJobOrchestrator), job); return(new OkObjectResult(job)); }