Created
June 27, 2020 17:18
-
-
Save CallumVass/e42c92b70247969282858bb58e62dd62 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
time1 will return the time the server started and won't change, ie will always be 27/06/2020 18:16:59 | |
time2 will work as I expected it to work, showing the current time the page was loaded |
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
open System | |
open Saturn.Application | |
open Saturn.Router | |
open Giraffe.ResponseWriters | |
let time () = DateTime.Now.ToString() | |
let timeHandler next context = | |
text (time ()) next context | |
let routes = router { | |
get "/time1" (text (time())) | |
get "/time2" timeHandler | |
} | |
let app = application { | |
use_router routes | |
} | |
[<EntryPoint>] | |
let main argv = | |
run app | |
0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment