diff options
author | Lia Lenckowski <lialenck@protonmail.com> | 2023-10-15 18:42:04 +0200 |
---|---|---|
committer | Lia Lenckowski <lialenck@protonmail.com> | 2023-10-15 18:49:35 +0200 |
commit | a7548f3da3897cd8bb247c784c50d39d642623b9 (patch) | |
tree | 81a73513429e619a4f259947f90e3b13c0e9e815 /src/Main.hs | |
parent | c575a2d9fe9eab97c6af7d20c577b6ea6a0e72aa (diff) | |
download | fastbangs-a7548f3da3897cd8bb247c784c50d39d642623b9.tar fastbangs-a7548f3da3897cd8bb247c784c50d39d642623b9.tar.bz2 fastbangs-a7548f3da3897cd8bb247c784c50d39d642623b9.tar.zst |
embed resources into executable
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Main.hs b/src/Main.hs index d69ced6..03709d4 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -11,6 +11,7 @@ import Control.Monad.Trans.Resource (runResourceT) import Control.Monad (when, unless) import Database.Persist.Sqlite import Data.Bool (bool) +import Data.FileEmbed (embedFile) import Data.Function ((&)) import Data.Pool (Pool) import Network.Wai.Handler.Warp hiding (getPort, getHost) @@ -53,20 +54,20 @@ instance YesodPersist Search where runDB action = getYesod >>= runSqlPool action . sqlPool -getHomeR :: Handler () +getHomeR :: Handler TypedContent getHomeR = do cacheSeconds $ 60 * 60 * 24 * 7 - sendFile typeHtml "index.html" + return $ TypedContent typeHtml $ toContent ($(embedFile "build/index.html")) -getBundleR :: Handler () +getBundleR :: Handler TypedContent getBundleR = do cacheSeconds $ 60 * 60 * 24 * 7 - sendFile typeJavascript "bundle.js" + return $ TypedContent typeJavascript $ toContent ($(embedFile "build/bundle.js")) -getStyleR :: Handler () +getStyleR :: Handler TypedContent getStyleR = do cacheSeconds $ 60 * 60 * 24 * 7 - sendFile typeCss "style.css" + return $ TypedContent typeCss $ toContent ($(embedFile "build/style.css")) getBangsR :: Handler TypedContent getBangsR = do |