-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.fs
43 lines (31 loc) · 1015 Bytes
/
Program.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
open Suave
open Suave.Filters
open Suave.Operators
open Suave.DotLiquid
open System.IO
open System.Reflection
let currentPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
let myHomeFolder = Path.Combine(Directory.GetCurrentDirectory(), "assets")
let initDotLiquid () =
let templatesDir = Path.Combine(currentPath, "views")
setTemplatesDir templatesDir
let cfg = {
defaultConfig with
bindings = [ HttpBinding.createSimple HTTP "127.0.0.1" 8080 ]
homeFolder = Some(myHomeFolder)
}
type Model = { title : string }
let o = { title = "Hello World" }
[<EntryPoint>]
let main argv =
printf "%s" myHomeFolder
initDotLiquid ()
setCSharpNamingConvention ()
let app =
choose [
pathRegex "(.*)\.(css|png|gif|js|ico)" >=> Files.browseHome
path "/" >=> choose [
GET >=> page "index.liquid" o ]
]
startWebServer cfg app
0