1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
9import Control.Monad (msum)
10import qualified Data.ByteString as BS
12import Snap.Http.Server
14import qualified Artifacts
16import qualified Endpoint.Compile as Compile
17import qualified Endpoint.Repl as Repl
26 do rArtifacts <- Artifacts.loadRepl
27 cArtifacts <- Artifacts.loadCompile
28 errorJS <- Compile.loadErrorJS
29 let depsInfo = Artifacts.toDepsInfo cArtifacts
31 httpServe config $ msum $
33 , path "repl" $ Repl.endpoint rArtifacts
34 , path "compile" $ Compile.endpoint cArtifacts
35 , path "compile/errors.js" $ serveJavaScript errorJS
36 , path "compile/deps-info.json" $ serveDepsInfo depsInfo
41config :: Config Snap a
43 setPort 8000 $ setAccessLog ConfigNoLog $ setErrorLog ConfigNoLog $ defaultConfig
48 do modifyResponse $ setContentType "text/plain"
49 writeBuilder "Status: OK"
54 do modifyResponse $ setResponseStatus 404 "Not Found"
55 modifyResponse $ setContentType "text/html; charset=utf-8"
56 writeBuilder "Not Found"
59serveJavaScript :: BS.ByteString -> Snap ()
60serveJavaScript javascript =
61 do modifyResponse $ setContentType "application/javascript"
65serveDepsInfo :: BS.ByteString -> Snap ()
67 Cors.allow GET ["https://elm-lang.org"] $
68 do modifyResponse $ setContentType "application/json"
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