nixify, README, license
This commit is contained in:
parent
b929e21f82
commit
0a00070dbb
33 changed files with 62 additions and 2112 deletions
22
src/Main.hs
22
src/Main.hs
|
@ -1,8 +1,10 @@
|
|||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Main (main) where
|
||||
|
||||
import ElmskellTypes
|
||||
import Data.FileEmbed (embedStringFile)
|
||||
import Data.Text.Lazy (Text)
|
||||
import Network.Wai.Handler.Warp (Port)
|
||||
import Network.Wai.Middleware.RequestLogger (logStdoutDev)
|
||||
|
@ -36,27 +38,31 @@ adminContact :: String
|
|||
adminContact = "[Matrix] @mtgmonkey:calitabby.net"
|
||||
|
||||
compiledElmAppFile :: AssetPath
|
||||
compiledElmAppFile = "/js/main.js"
|
||||
compiledElmAppFile = "/main.js"
|
||||
|
||||
boilerplateJsFile :: AssetPath
|
||||
boilerplateJsFile = "/js/init.js"
|
||||
boilerplateJsFile = "/init.js"
|
||||
|
||||
assetsFolder :: FilePath
|
||||
assetsFolder = "/home/mtgmonkey/elmskell/assets"
|
||||
assetsFolder = "."
|
||||
|
||||
compiledElmApp :: H.Html
|
||||
compiledElmApp = H.toHtml ($(embedStringFile "./main.js") :: String)
|
||||
|
||||
boilerplateJs :: H.Html
|
||||
boilerplateJs = H.toHtml ($(embedStringFile "./init.js") :: String)
|
||||
|
||||
-- MAIN
|
||||
main :: IO ()
|
||||
main = do
|
||||
|
||||
generateElmskellTypes
|
||||
|
||||
compiledElmAppOrExc <- E.try $ readFile $ assetsFolder ++ compiledElmAppFile :: IO (Either E.IOException String)
|
||||
let compiledElmApp = case compiledElmAppOrExc of
|
||||
let compiledElmApp' = case compiledElmAppOrExc of
|
||||
Left e -> serverErrorReadFile e
|
||||
Right contents -> H.toHtml $ contents
|
||||
|
||||
boilerplateJsOrExc <- E.try $ readFile $ assetsFolder ++ boilerplateJsFile :: IO (Either E.IOException String)
|
||||
let boilerplateJs = case boilerplateJsOrExc of
|
||||
let boilerplateJs' = case boilerplateJsOrExc of
|
||||
Left e -> serverErrorReadFile e
|
||||
Right contents -> H.toHtml $ contents
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue