on master help sign in
Lots of changes and reorganization
commitcbc197daefd0344d5994ca6d1e2bafe3c28e15da authorRyan Trinkle <ryan.trinkle@gmail.com> dateFri 29 Dec 2017, 21:16 (9 years ago) parentd76deb2
8 files changed+56−5
.gitmodules+5−5 obelisk-asset → asset backend/obelisk-backend.cabal+14 backend/src/Obelisk/Backend.hs+37 obelisk-example → example obelisk-font-awesome → font-awesome obelisk-https → https obelisk-snap → snap
.gitmodules+5−5
@@ -1,18 +1,18 @@
11[submodule "obelisk-asset"]
2− path = obelisk-asset
2+ path = asset
33 url = git@github.com:obsidiansystems/obelisk-asset.git
44[submodule "obelisk-font-awesome"]
5− path = obelisk-font-awesome
5+ path = font-awesome
66 url = git@github.com:obsidiansystems/obelisk-font-awesome.git
77[submodule "obelisk-https"]
8− path = obelisk-https
8+ path = https
99 url = git@github.com:obsidiansystems/obelisk-https
1010[submodule "reflex-platform"]
1111 path = reflex-platform
1212 url = git@github.com:reflex-frp/reflex-platform.git
1313[submodule "obelisk-snap"]
14− path = obelisk-snap
14+ path = snap
1515 url = git@github.com:obsidiansystems/obelisk-snap.git
1616[submodule "obelisk-example"]
17− path = obelisk-example
17+ path = example
1818 url = git@github.com:obsidiansystems/obelisk-example.git
obelisk-asset → assetrenamed

The content is the same.

backend/obelisk-backend.cabalnew file+14
@@ -0,0 +1,14 @@
1+name: obelisk-backend
2+version: 0.1
3+cabal-version: >= 1.2
4+build-type: Simple
5+
6+library
7+ hs-source-dirs: src
8+ build-depends: base,
9+ snap,
10+ snap-server,
11+ data-default,
12+ obelisk-asset-serve,
13+ bytestring
14+ exposed-modules: Obelisk.Backend
backend/src/Obelisk/Backend.hsnew file+37
@@ -0,0 +1,37 @@
1+module Obelisk.Backend
2+ ( backend
3+ , BackendConfig
4+ -- * Re-exports
5+ , Default (def)
6+ ) where
7+
8+import qualified Data.ByteString.Char8 as BSC8
9+import Data.Default (Default (..))
10+import Obelisk.Asset.Serve (serveAssets)
11+import System.IO (hSetBuffering, stderr, BufferMode (..))
12+import Snap (httpServe, defaultConfig, commandLineConfig)
13+import Snap.Internal.Http.Server.Config (Config (accessLog, errorLog), ConfigLog (ConfigIoLog))
14+
15+--TODO: Add a link to a large explanation of the idea of using 'def'
16+-- | Configure the operation of the Obelisk backend. For reasonable defaults,
17+-- use 'def'.
18+data BackendConfig = BackendConfig
19+
20+instance Default BackendConfig where
21+ def = BackendConfig
22+
23+-- | Start an Obelisk backend
24+backend :: BackendConfig -> IO ()
25+backend _ = do
26+ -- Make output more legible by decreasing the likelihood of output from
27+ -- multiple threads being interleaved
28+ hSetBuffering stderr LineBuffering
29+
30+ -- Get the web server configuration from the command line
31+ cmdLineConf <- commandLineConfig defaultConfig
32+ let httpConf = cmdLineConf
33+ { accessLog = Just $ ConfigIoLog BSC8.putStrLn
34+ , errorLog = Just $ ConfigIoLog BSC8.putStrLn
35+ }
36+ -- Start the web server
37+ httpServe httpConf $ serveAssets "static.assets" "static"
obelisk-example → examplerenamed

The content is the same.

obelisk-font-awesome → font-awesomerenamed

The content is the same.

obelisk-https → httpsrenamed

The content is the same.

obelisk-snap → snaprenamed

The content is the same.