2015-07-28 05:03:13 +00:00
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
module Main where
|
|
|
|
|
2015-07-28 05:54:37 +00:00
|
|
|
import Database.SQLite.Simple
|
|
|
|
import Web.Spock.Safe 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
|
|
|
|
conn <- open "../db/posts.db"
|
|
|
|
|
|
|
|
-- Simple tests to prove we're reading from SQLite
|
|
|
|
r <- query_ conn "SELECT * FROM Posts WHERE page=1" :: IO [Post]
|
|
|
|
let h = head r
|
|
|
|
|
|
|
|
-- Set up the URL router
|
|
|
|
runSpock 5000 $ spockT id $ do
|
|
|
|
get root $
|
2015-07-28 06:12:13 +00:00
|
|
|
text $ postBody h
|