summaryrefslogtreecommitdiff
path: root/ibb/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'ibb/Main.hs')
-rw-r--r--ibb/Main.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/ibb/Main.hs b/ibb/Main.hs
index 544b0c8..05e7738 100644
--- a/ibb/Main.hs
+++ b/ibb/Main.hs
@@ -3,6 +3,7 @@
module Main where
+import Data.Maybe (fromMaybe)
import Data.ByteString.Lazy (ByteString)
import Data.Text.Lazy (Text)
import Data.Text.Lazy.Encoding (encodeUtf8)
@@ -13,6 +14,7 @@ import Text.Hamlet (shamlet)
import Text.Lucius (lucius, renderCss)
import Web.Scotty (ActionM, scotty, get, html, raw, setHeader)
import Influencers
+import System.Environment (lookupEnv)
render :: Html -> ActionM ()
render = html . renderHtml
@@ -21,7 +23,11 @@ css :: ByteString -> ActionM ()
css src = setHeader "content-type" "text/css" >> raw src
main :: IO ()
-main = scotty 3000 $ do
+main = do
+ port <- read <$> fromMaybe "3000" <$> lookupEnv "PORT" :: IO Int
+ scotty port routes
+
+routes = do
get "/" $ render homepage
get "/custom.css" $ css stylesheet