I'll like to serve all files in my 'public' folder with suave
Inside my public I have:
/index.html
/styles/main.css
/scripts/app.js
/images/*.(png|jpg)
Do I use a homeFolder? Or how does this work? Does the public folder need to be copied next to the executable in my bin folder? A code snippet would be much appreciated. Thanks.
Edit:
The solution looks like this:
open Suave
open Suave.Filters
open Suave.Operators
open Suave.Successful
open System.IO
let app =
choose [
GET >=> choose
[path "/" >=> OK "test" ; Files.browseHome]
POST >=> choose
[path "/foo" >=> OK "thanks"]
]
let myHomeFolder = Path.Combine(Directory.GetCurrentDirectory(), "public")
let cfg = {
defaultConfig with
homeFolder = Some(myHomeFolder)
}
[<EntryPoint>]
let main argv =
printfn "%A" argv
startWebServer cfg app
System.Console.ReadLine() |> ignore
0 // return an integer exit code