Use API exported by Spock-core (fix issue #1)
This commit is contained in:
parent
7c4da1cdd9
commit
a0bf4807a0
@ -30,7 +30,7 @@ executable breve
|
|||||||
Breve.Generator, Breve.UrlTable
|
Breve.Generator, Breve.UrlTable
|
||||||
other-extensions: OverloadedStrings
|
other-extensions: OverloadedStrings
|
||||||
build-depends: base >=4.8 && <5.0, warp, warp-tls, tls,
|
build-depends: base >=4.8 && <5.0, warp, warp-tls, tls,
|
||||||
Spock, blaze-html, http-types,
|
Spock, Spock-core, blaze-html, http-types,
|
||||||
wai, wai-middleware-static, wai-extra,
|
wai, wai-middleware-static, wai-extra,
|
||||||
transformers, mtl,
|
transformers, mtl,
|
||||||
text, aeson, bytestring, binary,
|
text, aeson, bytestring, binary,
|
||||||
|
@ -12,7 +12,7 @@ import Data.Aeson hiding (json)
|
|||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
import qualified Data.Text.IO as T
|
import qualified Data.Text.IO as T
|
||||||
|
|
||||||
import Web.Spock.Safe
|
import Web.Spock.Core
|
||||||
import Network.HTTP.Types.Status
|
import Network.HTTP.Types.Status
|
||||||
import Network.Wai (Middleware)
|
import Network.Wai (Middleware)
|
||||||
import Network.Wai.Middleware.Static
|
import Network.Wai.Middleware.Static
|
||||||
@ -76,4 +76,4 @@ toTLS :: Text -> SpockT IO ()
|
|||||||
toTLS host = do
|
toTLS host = do
|
||||||
get var (redirect . new)
|
get var (redirect . new)
|
||||||
get "/" (redirect $ new "")
|
get "/" (redirect $ new "")
|
||||||
where new url = "https://" <> host <> "/" <> url
|
where new url = "https://" <> host <> "/" <> url
|
||||||
|
@ -8,7 +8,7 @@ import Data.Text (Text, unpack)
|
|||||||
import Control.Concurrent (forkIO)
|
import Control.Concurrent (forkIO)
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
|
|
||||||
import Web.Spock.Safe
|
import Web.Spock.Core
|
||||||
import Network.Wai.Handler.WarpTLS (runTLS, TLSSettings)
|
import Network.Wai.Handler.WarpTLS (runTLS, TLSSettings)
|
||||||
import Network.Wai.Handler.Warp (run, defaultSettings, setPort)
|
import Network.Wai.Handler.Warp (run, defaultSettings, setPort)
|
||||||
|
|
||||||
@ -34,4 +34,4 @@ main = do
|
|||||||
when (bindPort == 443) (forkIO' $ runTLSRedirect bindHost)
|
when (bindPort == 443) (forkIO' $ runTLSRedirect bindHost)
|
||||||
|
|
||||||
putStrLn ("Serving on " ++ unpack bindUrl)
|
putStrLn ("Serving on " ++ unpack bindUrl)
|
||||||
runBreve tlsSettings bindPort (app bindUrl table)
|
runBreve tlsSettings bindPort (app bindUrl table)
|
||||||
|
@ -7,7 +7,7 @@ import Data.Text.Lazy (toStrict)
|
|||||||
import Text.Blaze.Html.Renderer.Text (renderHtml)
|
import Text.Blaze.Html.Renderer.Text (renderHtml)
|
||||||
import Text.Blaze.Html5 as H
|
import Text.Blaze.Html5 as H
|
||||||
import Text.Blaze.Html5.Attributes as A
|
import Text.Blaze.Html5.Attributes as A
|
||||||
import qualified Web.Spock.Safe as S
|
import qualified Web.Spock.Core as S
|
||||||
|
|
||||||
render :: Html -> S.ActionT IO ()
|
render :: Html -> S.ActionT IO ()
|
||||||
render = S.html . toStrict . renderHtml
|
render = S.html . toStrict . renderHtml
|
||||||
|
Loading…
Reference in New Issue
Block a user