@@ -7,6 +7,7 @@ module Main
9import Control.Monad (msum)
9import Control.Monad (msum)
10+import qualified Data.ByteString as BS
10import Snap.Core
11import Snap.Core
11import Snap.Http.Server
12import Snap.Http.Server
@@ -32,8 +33,7 @@ main =
32 , path "repl" $ Repl.endpoint rArtifacts
33 , path "repl" $ Repl.endpoint rArtifacts
33 , path "compile" $ Compile.endpoint cArtifacts
34 , path "compile" $ Compile.endpoint cArtifacts
34 , path "compile/errors.js" $ writeBS errorJS
35 , path "compile/errors.js" $ writeBS errorJS
35− , path "compile/deps-info.json" $
36+ , path "compile/deps-info.json" $ serveDepsInfo depsInfo
36− Cors.allow GET ["https://elm-lang.org"] (writeBS depsInfo)
37 , notFound
37 , notFound
@@ -54,3 +54,10 @@ notFound =
54 do modifyResponse $ setResponseStatus 404 "Not Found"
54 do modifyResponse $ setResponseStatus 404 "Not Found"
55 modifyResponse $ setContentType "text/html; charset=utf-8"
55 modifyResponse $ setContentType "text/html; charset=utf-8"
56 writeBuilder "Not Found"
56 writeBuilder "Not Found"
59+serveDepsInfo :: BS.ByteString -> Snap ()
61+ Cors.allow GET ["https://elm-lang.org"] $
62+ do modifyResponse $ setContentType "application/json"