Browse Source

* added plaintext benchmark

Saurabh Nanda 9 years ago
parent
commit
60339a5939

+ 3 - 9
frameworks/Haskell/yesod-postgres/bench/src/Main.hs

@@ -101,6 +101,7 @@ data App = App
 
 
 
 
 mkYesod "App" [parseRoutes|
 mkYesod "App" [parseRoutes|
+/json               JsonR     GET
 /plaintext          PlaintextR   GET
 /plaintext          PlaintextR   GET
 /db                 DbR          GET
 /db                 DbR          GET
 /queries/#Int       QueriesR     GET
 /queries/#Int       QueriesR     GET
@@ -128,15 +129,8 @@ instance Yesod App where
     maximumContentLength _ _ = Nothing
     maximumContentLength _ _ = Nothing
     {-# INLINE maximumContentLength #-}
     {-# INLINE maximumContentLength #-}
 
 
--- getJsonR :: Handler ()
--- getJsonR = sendWaiResponse
---          $ responseBuilder
---             status200
---             [("Content-Type", simpleContentType typeJson)]
---          $ copyByteString
---          $ L.toStrict
---          $ encode
---          $ object ["message" .= ("Hello, World!" :: Text)]
+getJsonR :: Handler Value
+getJsonR = returnJson $ object ["message" .= ("Hello, World!" :: Text)]
 
 
 runPg dbAction = do
 runPg dbAction = do
   app <- getYesod
   app <- getYesod

+ 1 - 0
frameworks/Haskell/yesod-postgres/benchmark_config.json

@@ -3,6 +3,7 @@
   "tests": [{
   "tests": [{
     "default": {
     "default": {
       "setup_file": "setup",
       "setup_file": "setup",
+      "json_url": "/json",
       "plaintext_url": "/plaintext",
       "plaintext_url": "/plaintext",
       "db_url": "/db",
       "db_url": "/db",
       "query_url": "/queries/",
       "query_url": "/queries/",