A hybrid F#/C# blazor sample app to kick the tyres of blazor.
- The biggest issue that I encountered was the deserialisation of FSharp records on blazor. As I understand Blazor comes with a library called SimpleJson which does not deserialise f# record or union types.
- One way to solve this is by using f# classes rather than records for dtoing between client and api.
- I was able to serialise simple f# command records on blazor and send to api endpoint.
- Client side there is no problem calling into and consuming F# types from Blazor C# so one can pack as much F# magic into a Blazor app as required.
You can setup a Survey definition with sections and 4 types of questions within those sections. Once you make the survey definition live you can add one or more survey responses based on survey definition.
Clearly in a real world app you would do survey admin in one place and survey responses in another but this app is just to evaluate what is possible in Blazor.
Please forgive brutal css design, send me a PR if you can improve.
Survey Definition Screen
Build and Run
From the root directory you can run buildseedrun.bat and it should build, seed the app and run. You can also run from visual studio. If you have not run Blazor on your system before then head over here to Blazor site get started
- Client side
- Blazor in c# but making calls to shared F# library
- Server side
- Asp.Net core api endpoint in F#
- Sqlite for storage
- Chessie for validation ROP
- Expecto for testing - (not very many tests, but was good to drive out the initial Survey Definition model)
- Trail if you want to go all in with F# on Blazor