aboutsummaryrefslogtreecommitdiff
path: root/src/IRE/Application.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/IRE/Application.hs')
-rw-r--r--src/IRE/Application.hs19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/IRE/Application.hs b/src/IRE/Application.hs
index 530e4a4..bd8c796 100644
--- a/src/IRE/Application.hs
+++ b/src/IRE/Application.hs
@@ -1,16 +1,18 @@
{-# LANGUAGE OverloadedStrings #-}
-module IRE.Application (
- app
-) where
+module IRE.Application
+ ( app
+ ) where
import Control.Monad.Trans (liftIO)
import Network.Wai (Application)
-import Network.Wai.Middleware.Static (addBase, hasPrefix, staticPolicy, (>->))
+import Network.Wai.Middleware.Static
+ ((>->), addBase, hasPrefix, staticPolicy)
import Network.Wai.Parse (FileInfo(..))
import System.FilePath.Posix ((</>))
-import Web.Scotty ( ActionM, ScottyM, file, files, get,
- json, middleware, post, scottyApp )
+import Web.Scotty
+ (ActionM, ScottyM, file, files, get, json, middleware, post,
+ scottyApp)
import IRE.Application.YOLO (findItems)
import IRE.YOLO (Detector)
@@ -22,14 +24,11 @@ ire :: FilePath -> Detector -> ScottyM ()
ire rootDir net = do
middleware $ staticPolicy (hasPrefix "static" >-> addBase rootDir)
get "/" $ file (rootDir </> "webui.html")
-
post "/findItems" $ apiFindItems net
-
apiFindItems :: Detector -> ActionM ()
apiFindItems net = do
fs <- files
- let fc = head [ fileContent fi | (_, fi) <- fs ]
+ let fc = head [fileContent fi | (_, fi) <- fs]
resp <- liftIO $ findItems net fc
json resp
-