-
-
Save supertom44/3cee3bdd1aaa40e46f4007aa2aa9af3f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SuaveDotLiquidSample | |
open Suave | |
open Suave.Operators | |
open Suave.Filters | |
DotLiquid.setTemplatesDir (__SOURCE_DIRECTORY__ + "/templates") | |
type Person = { Name : string; Age : int } | |
let people = [{Name = "Thomas"; Age = 29};{Name = "Martin"; Age = 35}] | |
let index = DotLiquid.page "index.html" (people) | |
let details name = DotLiquid.page "details.html" (people |> List.find (fun i -> i.Name = name)) | |
let app = choose [ | |
path "/" >=> index | |
pathScan "/details/%s" (fun (name) -> details name) | |
] | |
startWebServer defaultConfig app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment