diff options
author | Yuchen Pei <hi@ypei.me> | 2022-11-22 23:13:06 +1100 |
---|---|---|
committer | Yuchen Pei <hi@ypei.me> | 2022-11-22 23:13:06 +1100 |
commit | 55d1e6c9a9f41394a37b48c42f65cc02274b9ab7 (patch) | |
tree | 6d8d2763f69eb39c07cb63888b1516660ea7aa1d /app/Main.hs |
initial commit
Diffstat (limited to 'app/Main.hs')
-rw-r--r-- | app/Main.hs | 40 |
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 |