/falco-api-with-tests-template

Falco API with tests (xUnit, FsUnit) basic template

Primary LanguageF#

F# Falco API with tests template

How to use it

Clone the repo!

Requirements

dotNET 7 (you can downgrade dotnet version to 6.0 easily in the fsproj files)

Editor capable of working with F#, I personally recommend:

Other options:

Stuff inside API

The reason for using Feliz.ViewEngine is that I heavily use it in frontend application and if I were to write SSR I would prefer to use it for consistency. As this is a template I use myself, this is what I wanted here. Feel free to remove it. Similar stuff written in Falco.Markup have looked like this:

let indexView =
  Elem.html [] [
    Elem.head [] [ Elem.title [] [ Text.raw "Falco Sample" ]]
    Elem.body [] [
      Elem.h1 [] [ Text.raw "I |> F#" ]
      Elem.p [Attr.class' "some-css-class"; Attr.id "someId"] [ Text.raw "Hello World"]
    ]
  ]

let defaultPage = Response.ofHtml indexView

Take a look at similar:

Stuff inside TESTS

How to run:

  • api - cd api && dotnet run
  • tests - cd tests && dotnet test

What if I don't want tests?

Just remove the tests folder!

Why make this template?

Comparison with Saturn & Giraffe templates I already made This template is meant a nice fresh start, without much complication

Routes to test: