Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pass Sqlite3 connection to controllers
- Loading branch information
1 parent
c4774c8
commit a372318
Showing
3 changed files
with
11 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,18 +1,21 @@ | |||
module Main (main) where | module Main (main) where | ||
|
|
||
import Control.Monad (void) | |||
|
|||
import Network.Wai.Handler.Warp (run) | import Network.Wai.Handler.Warp (run) | ||
import Network.Wai.Middleware.RequestLogger (logStdoutDev) | import Network.Wai.Middleware.RequestLogger (logStdoutDev) | ||
import Network.Wai.Middleware.Autohead (autohead) | import Network.Wai.Middleware.Autohead (autohead) | ||
import Network.Wai.Middleware.Jsonp (jsonp) | import Network.Wai.Middleware.Jsonp (jsonp) | ||
import Network.Wai.Middleware.AcceptOverride (acceptOverride) | import Network.Wai.Middleware.AcceptOverride (acceptOverride) | ||
|
|
||
import Database.SQLite.Simple (withConnection) | |||
|
|||
import Network.Wai.Dispatch | import Network.Wai.Dispatch | ||
import Routes | import Routes | ||
import Application | import Application | ||
|
|
||
main :: IO () | main :: IO () | ||
main = do | main = void $ withConnection "./dev.db" | ||
putStrLn "Running..." | (\db -> run 3000 $ | ||
run 3000 $ | |||
logStdoutDev $ autohead $ acceptOverride $ jsonp $ -- Middleware | logStdoutDev $ autohead $ acceptOverride $ jsonp $ -- Middleware | ||
dispatch on404 $ routes -- Do routing | dispatch on404 $ routes db) -- Do routing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters