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
|
|
|
|
import qualified Web.Spock.Safe as S hiding (head)
|
2015-07-28 06:18:58 +00:00
|
|
|
import Within.DBMemorial.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
|
2015-07-28 06:29:29 +00:00
|
|
|
r <- Db.query_ conn "SELECT * FROM Posts WHERE page=1" :: IO [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 $ postBody h
|