Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submission : F# of-watchdog http template (ASP.NET Core v7) #149

Open
zakaluka opened this issue Jun 13, 2022 · 2 comments
Open

Submission : F# of-watchdog http template (ASP.NET Core v7) #149

zakaluka opened this issue Jun 13, 2022 · 2 comments

Comments

@zakaluka
Copy link

Hello,

I would like to submit a proposal for an OpenFaaS template that uses F# and ASP.NET Core with .NET v6.0 (latest stable release). Here is a link to the repo containing the template: https://github.com/zakaluka/fsharp-httprequest-template

Why I made this template

While there are some .NET templates (csharp, csharp-httprequest, csharp-kestrel), all of them are C# specific. While both F# and C# are .NET languages and (at least in my template) utilize ASP.NET Core under the hood, functional ASP.NET Core programming in F# is often accomplished using a wrapper like Giraffe (which is used here) or Saturn (not used in this template).

This new template uses Giraffe and the functional style advocated by Giraffe to build and expose a web service. Despite the addition of Giraffe, the template is relatively minimal and does not create a dependency on a database or other external platform.

Why to use this template?

  • Based on https://github.com/distantcam/csharp-httprequest-template, an already-approved template for OpenFaaS .NET functions.
  • Uses on .NET 6 (latest GA) and of-watchdog 0.9.6. This means that it uses Kestrel already because it is the default launch profile in .NET v6 and there is no need for separate templates like C# has.
  • Uses F# programming paradigms for familiarity
  • Provides working solution OOTB, user only has to tweak the routing and function to meet their needs.
  • Easy to add dependencies, perform builds, testing, etc. using built-in .NET tools (dotnet package add ...)

Why not to use this template?

  • Requires the latest .NET 6. Can be downgraded easily (in the easiest instance, by modifying the 2 .fspoj files) to .NET v5, .NET Core v3, or .NET Framework v4.x, but this would be an end-user activity.
  • Does not provide a built-in framework like SAFE Stack - the template is purposely kept minimal in the spirit of FaaS solutions. However, all dependencies can be easily added by the user if they want to use SAFE or another framework.
  • Does not use a non-ASP.NET Core web platform, like Suave or NancyFX.

Thank you for your time and consideration.

@zakaluka zakaluka changed the title Submission : F# of-watchdog http template Submission : F# of-watchdog http template (ASP.NET Core v6) Jun 13, 2022
@zakaluka
Copy link
Author

Update: Modified the routing function so that no change is required by the user - they can just modify the FunctionHandler body to take the desired action. The FunctionHanlder receives both path and query parameters (for GET), plus has access to other elements such as the payload of a POST (not implemented in sample).

@sachinshahredmane
Copy link

This template has been updated to .NET 7 now

@zakaluka zakaluka changed the title Submission : F# of-watchdog http template (ASP.NET Core v6) Submission : F# of-watchdog http template (ASP.NET Core v7) Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants