time-wasting-thread-memorial/web/src/Main.hs

20 lines
546 B
Haskell
Raw Normal View History

2015-07-28 05:03:13 +00:00
{-# LANGUAGE OverloadedStrings #-}
module Main where
2015-07-28 06:29:29 +00:00
import qualified Database.SQLite.Simple as Db
2015-07-28 07:00:18 +00:00
import qualified Web.Spock.Safe as S hiding (head)
import qualified Within.DBMemorial.Post as Post
2015-07-28 05:03:13 +00:00
main :: IO ()
2015-07-28 05:54:37 +00:00
main = do
2015-07-28 06:29:29 +00:00
conn <- Db.open "../db/posts.db"
2015-07-28 05:54:37 +00:00
-- Simple tests to prove we're reading from SQLite
r <- Db.query_ conn "SELECT * FROM Posts WHERE page=1" :: IO [Post.Post]
2015-07-28 05:54:37 +00:00
let h = head r
-- Set up the URL router
2015-07-28 06:29:29 +00:00
S.runSpock 5000 $ S.spockT id $ do
S.get S.root $
S.text $ Post.body h