diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2017-08-03 21:26:33 +0300 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2017-08-03 21:32:06 +0300 |
commit | b1a599a6df4100ca1da6e778d1fdade3efe01451 (patch) | |
tree | 88e4e16c6f242cb92473d899cdfa0f10c84ddd4e /src/IRE/Application.hs | |
parent | 1c621db4b5b0d78ae6b2f79c71122c6cca2a0815 (diff) | |
download | ire-master.tar.gz |
Diffstat (limited to 'src/IRE/Application.hs')
-rw-r--r-- | src/IRE/Application.hs | 19 |
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 - |