Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add MongoDB dep

  • Loading branch information...
commit 0974f3715c2e399ca825ff607844cd25258d8863 1 parent d440590
@lukasser authored
View
7 log/access.log
@@ -0,0 +1,7 @@
+127.0.0.1 - - [23/May/2011:22:24:52 +0200] "GET / HTTP/1.1" 200 - - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.60 Safari/534.30"
+127.0.0.1 - - [23/May/2011:22:24:52 +0200] "GET /screen.css HTTP/1.1" 200 - "http://localhost:8000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.60 Safari/534.30"
+127.0.0.1 - - [23/May/2011:22:24:52 +0200] "GET /favicon.ico HTTP/1.1" 404 3 - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.60 Safari/534.30"
+127.0.0.1 - - [23/May/2011:22:24:57 +0200] "GET /echo/fish HTTP/1.1" 200 - "http://localhost:8000/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.60 Safari/534.30"
+127.0.0.1 - - [23/May/2011:22:24:57 +0200] "GET /favicon.ico HTTP/1.1" 404 3 - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.60 Safari/534.30"
+127.0.0.1 - - [23/May/2011:22:24:59 +0200] "GET / HTTP/1.1" 200 - "http://localhost:8000/echo/fish" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.60 Safari/534.30"
+127.0.0.1 - - [23/May/2011:22:24:59 +0200] "GET /favicon.ico HTTP/1.1" 404 3 - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.60 Safari/534.30"
View
3  log/error.log
@@ -0,0 +1,3 @@
+[23/May/2011:22:24:43 +0200] Server.httpServe: START (EventLoopSimple)
+[23/May/2011:22:26:21 +0200] Server.httpServe: SHUTDOWN
+[23/May/2011:22:26:21 +0200] Server.httpServe: BACKEND STOPPED
View
7 snap-store.cabal
@@ -29,7 +29,12 @@ Executable snap-store
snap-server == 0.4.*,
text >= 0.11 && < 0.12,
time >= 1.1 && < 1.3,
- xmlhtml == 0.1.*
+ xmlhtml == 0.1.*,
+ snap-extension-mongodb >= 0.3.3,
+ bson,
+ compact-string-fix,
+ transformers,
+ mongoDB
extensions: TypeSynonymInstances MultiParamTypeClasses
View
10 src/Application.hs
@@ -13,7 +13,7 @@ module Application
import Snap.Extension
import Snap.Extension.Heist.Impl
import Snap.Extension.Timer.Impl
-
+import Snap.Extension.DB.MongoDB
------------------------------------------------------------------------------
-- | 'Application' is our application's monad. It uses 'SnapExtend' from
@@ -30,6 +30,7 @@ type Application = SnapExtend ApplicationState
data ApplicationState = ApplicationState
{ templateState :: HeistState Application
, timerState :: TimerState
+ , dbState ;: MongoDBState
}
@@ -44,6 +45,10 @@ instance HasTimerState ApplicationState where
getTimerState = timerState
setTimerState s a = a { timerState = s }
+------------------------------------------------------------------------------
+instance HasMongoDBState ApplicationState where
+ getMongoDBState = dbState
+ setMongoDBState s a = a { dbState = s }
------------------------------------------------------------------------------
-- | The 'Initializer' for ApplicationState. For more on 'Initializer's, see
@@ -55,4 +60,5 @@ applicationInitializer :: Initializer ApplicationState
applicationInitializer = do
heist <- heistInitializer "resources/templates"
timer <- timerInitializer
- return $ ApplicationState heist timer
+ db <- mongoDBInitialize (Host "127.0.0.1" $ PortNumber 27017) 1 "store"
+ return $ ApplicationState heist timer db
Please sign in to comment.
Something went wrong with that request. Please try again.