Application package:hledger-web
Complete the definition of the web app begun in App.hs. This is always
done in two files for (TH?) reasons.
The WAI application.
Note that, since WAI 3.0, this type is structured in continuation
passing style to allow for proper safe resource handling. This was
handled in the past via other means (e.g.,
ResourceT). As a
demonstration:
app :: Application
app req respond = bracket_
(putStrLn "Allocating scarce resource")
(putStrLn "Cleaning up")
(respond $ responseLBS status200 [] "Hello World")
Switch over to handling the current request with a WAI
Application.