1{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE TypeFamilies #-}
3{-# LANGUAGE DeriveGeneric #-}
4{-# LANGUAGE TypeOperators #-}
5{-# LANGUAGE OverloadedStrings #-}
8import Control.Monad.IO.Class
9import Control.Monad.Trans.Either
14import System.Directory
16type IOAPI = "myfile.txt" :> Get '[JSON] FileContent
21newtype FileContent = FileContent
25instance ToJSON FileContent
29 exists <- liftIO (doesFileExist "myfile.txt")
31 then liftIO (readFile "myfile.txt") >>= return . FileContent
32 else left custom404Err
34 where custom404Err = err404 { errBody = "myfile.txt just isn't there, please leave this server alone." }
37app = serve ioAPI server
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list