【发布时间】:2011-11-30 00:41:21
【问题描述】:
我希望添加一些钩子,用于使用Snap 在 Web 应用程序中预处理 Heist 模板。到目前为止,我的天真的方法是在我的应用程序初始化程序中使用以下代码:
app :: SnapletInit App App
app = makeSnaplet "app" "The main web application" Nothing $ do
-- ...
h <- nestSnaplet "heist" heist $ heistInit "resources/templates"
-- ...
modifyHeistTS . addOnLoadHook $ myTemplateHook
这段代码当然不起作用,因为钩子是在之后从“资源/模板”加载模板
如何在加载初始模板之前修改 Heist 模板状态,以添加 OnLoad 挂钩?
【问题讨论】:
-
heistInit' 函数允许你想要什么,现在在 github 上。
标签: web-services haskell haskell-snap-framework heist