on master help sign in
Update executables to use routes
commitdf1aa9d9216753540da8c8667530c8a82c925e42 authorAli Abrar <aliabrar@gmail.com> dateSun 2 Sep 2018, 15:35 (8 years ago) parentaaee301
4 files changed+13−25
skeleton/backend/backend.cabal+1−5 skeleton/backend/src-bin/main.hs+3−17 skeleton/frontend/frontend.cabal+2−1 skeleton/frontend/src-bin/main.hs+7−2
skeleton/backend/backend.cabal+1−5
@@ -11,6 +11,7 @@ library
1111 , common
1212 , frontend
1313 , obelisk-backend
14+ , obelisk-route
1415 exposed-modules:
1516 Backend
1617 ghc-options: -Wall
@@ -24,9 +25,4 @@ executable backend
2425 , backend
2526 , common
2627 , frontend
27− , lens
28− , modern-uri
2928 , obelisk-backend
30− , obelisk-executable-config
31− , obelisk-executable-config-inject
32− , text
skeleton/backend/src-bin/main.hs+3−17
@@ -1,20 +1,6 @@
1−{-# LANGUAGE OverloadedStrings #-}
2−import Control.Exception
3−import Control.Lens
4−import Data.Maybe
5−import Data.Text.Encoding
6−import Obelisk.ExecutableConfig (get)
7−import System.Environment
8−import qualified Text.URI as URI
9−import Text.URI.Lens
10−
111import Backend
2+import Frontend
3+import Obelisk.Backend
124
135main :: IO ()
14−main = do
15− Just route <- get "common/route"
16− port <- case URI.mkURI route of
17− Left err -> fail $ show err
18− Right uri -> return $ fromMaybe 8000 $ uri ^? uriAuthority . _Right . authPort . _Just
19− withArgs ["--port", show port] backend
20−
6+main = runBackend backend frontend
skeleton/frontend/frontend.cabal+2−1
@@ -21,9 +21,10 @@ executable frontend
2121 hs-source-dirs: src-bin
2222 build-depends: base
2323 , common
24+ , obelisk-frontend
25+ , obelisk-route
2426 , reflex-dom
2527 , static
26− , text
2728 , frontend
2829 --TODO: Make these ghc-options optional
2930 ghc-options: -threaded
skeleton/frontend/src-bin/main.hs+7−2
@@ -1,5 +1,10 @@
1−import Reflex.Dom
21import Frontend
2+import Common.Route
3+import Obelisk.Frontend
4+import Obelisk.Route.Frontend
5+import Reflex.Dom
36
47main :: IO ()
5−main = mainWidget $ snd frontend
8+main = do
9+ let Right validFullEncoder = checkEncoder backendRouteEncoder
10+ run $ runFrontend validFullEncoder frontend