aboutsummaryrefslogtreecommitdiff
path: root/app/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'app/Main.hs')
-rw-r--r--app/Main.hs40
1 files changed, 40 insertions, 0 deletions
diff --git a/app/Main.hs b/app/Main.hs
new file mode 100644
index 0000000..94da226
--- /dev/null
+++ b/app/Main.hs
@@ -0,0 +1,40 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE TypeOperators #-}
+module Main where
+
+import Data.Proxy ( Proxy(..) )
+import Data.Text ( Text )
+import qualified Data.Text as T
+import Network.Wai.Handler.Warp ( run )
+import Servant ( (:>)
+ , Application
+ , CaptureAll
+ , Get
+ , Handler
+ , JSON
+ , Server
+ , serve
+ )
+
+type API = GetPageCompliance
+
+type GetPageCompliance = CaptureAll "url" Text :> Get '[JSON] Text
+
+server :: Server API
+server = getPageCompliance
+
+getPageCompliance :: [Text] -> Handler Text
+getPageCompliance url =
+ return
+ $ "You have requested librejs-compliance info for "
+ <> T.intercalate "/" url
+
+app :: Application
+app = serve api server
+
+api :: Proxy API
+api = Proxy
+
+main :: IO ()
+main = run 5678 app