Use API exported by Spock-core (fix issue #1)

master
rnhmjoj 2017-01-13 23:21:56 +01:00
parent 7c4da1cdd9
commit a0bf4807a0
No known key found for this signature in database
GPG Key ID: 362BB82B7E496B7C
4 changed files with 6 additions and 6 deletions

View File

@ -30,7 +30,7 @@ executable breve
Breve.Generator, Breve.UrlTable
other-extensions: OverloadedStrings
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,
transformers, mtl,
text, aeson, bytestring, binary,

View File

@ -12,7 +12,7 @@ import Data.Aeson hiding (json)
import Data.Text (Text)
import qualified Data.Text.IO as T
import Web.Spock.Safe
import Web.Spock.Core
import Network.HTTP.Types.Status
import Network.Wai (Middleware)
import Network.Wai.Middleware.Static
@ -76,4 +76,4 @@ toTLS :: Text -> SpockT IO ()
toTLS host = do
get var (redirect . new)
get "/" (redirect $ new "")
where new url = "https://" <> host <> "/" <> url
where new url = "https://" <> host <> "/" <> url

View File

@ -8,7 +8,7 @@ import Data.Text (Text, unpack)
import Control.Concurrent (forkIO)
import Control.Monad
import Web.Spock.Safe
import Web.Spock.Core
import Network.Wai.Handler.WarpTLS (runTLS, TLSSettings)
import Network.Wai.Handler.Warp (run, defaultSettings, setPort)
@ -34,4 +34,4 @@ main = do
when (bindPort == 443) (forkIO' $ runTLSRedirect bindHost)
putStrLn ("Serving on " ++ unpack bindUrl)
runBreve tlsSettings bindPort (app bindUrl table)
runBreve tlsSettings bindPort (app bindUrl table)

View File

@ -7,7 +7,7 @@ import Data.Text.Lazy (toStrict)
import Text.Blaze.Html.Renderer.Text (renderHtml)
import Text.Blaze.Html5 as H
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 = S.html . toStrict . renderHtml