Skip to content
This repository has been archived by the owner on Nov 26, 2021. It is now read-only.

goncalo-oliveira/faas-aspnet-functions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenFaaS ASPNET Functions

Function handler abstracts used by the template and function implementations.

Since the release of v2.x of the template, this package is no longer used and considered deprecated. See here how to migrate your function if you're still using v1.x.

Learn more about the template.

Learn more about OpenFaas.

IHttpFunction

This interface defines a contract for an ASPNET function. A function implementation needs to implement, as a base minimum, this interface.

public interface IHttpFunction
{
    Task<IActionResult> HandleAsync( HttpRequest request );
}

HttpFunction

An abstract implementation for the IHttpFunction interface. Although not required, the template by default generates a function that inherits from this class. It provides a few helper methods to make it easier to return specific IActionResult objects, simillar to ASPNET ControllerBase class.

public class Function : HttpFunction
{
   [HttpPost]
   public override async Task<IActionResult> HandleAsync( HttpRequest request )
   {
      var result = await DoSomethingAsync();
      
      return Ok( result );
   }
}