Directly create response
This commit is contained in:
parent
b4d697a0dd
commit
19e71ff950
@ -34,7 +34,7 @@ app url' table = do
|
||||
middleware (serveStatic static)
|
||||
middleware logStdout
|
||||
|
||||
get "/" $ html (render index)
|
||||
get "/" $ render index
|
||||
|
||||
get var $ \name -> do
|
||||
url <- liftIO (extract table name)
|
||||
@ -52,7 +52,7 @@ app url' table = do
|
||||
name <- liftIO (insert table url)
|
||||
logStr (printf "Registered %s -> %s " url name)
|
||||
let link = url' <> name
|
||||
html (render $ done link)
|
||||
render (done link)
|
||||
|
||||
post "api" $ do
|
||||
url <- fmap unpack <$> param "url"
|
||||
|
@ -7,9 +7,10 @@ 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
|
||||
|
||||
render :: Html -> Text
|
||||
render = toStrict . renderHtml
|
||||
render :: Html -> S.ActionT IO ()
|
||||
render = S.html . toStrict . renderHtml
|
||||
|
||||
done :: String -> Html
|
||||
done url = template $ do
|
||||
|
Loading…
Reference in New Issue
Block a user