Commit a6bd2e32 authored by julien dehos's avatar julien dehos

nix-build + compress

parent 5b2640bd
let
pkgs = import ./nixpkgs.nix ;
miso-xhr-src = ./. ;
server = pkgs.haskell.packages.ghc.callCabal2nix "miso-xhr" ./. {};
client = pkgs.haskell.packages.ghcjs.callCabal2nix "miso-xhr" ./. {};
in
pkgs.runCommand "miso-xhr" { inherit client server; } ''
mkdir -p $out/{bin,static}
cp ${server}/bin/* $out/bin/
${pkgs.closurecompiler}/bin/closure-compiler ${client}/bin/client.jsexe/all.js > $out/static/all.js
cp ${miso-xhr-src}/static/*.png $out/static/
''
......@@ -9,11 +9,14 @@ import Data.Proxy (Proxy(..))
import qualified Lucid as L
import Miso
import Network.Wai.Handler.Warp (run)
import qualified Network.Wai.Middleware.Gzip as Wai
import Network.Wai.Middleware.RequestLogger (logStdout)
import Servant
main :: IO ()
main = run 3000 $ logStdout $ serve (Proxy @ServerApi) server
main = run 3000 $ logStdout $ compress app
where app = serve (Proxy @ServerApi) server
compress = Wai.gzip Wai.def { Wai.gzipFiles = Wai.GzipCompress }
type ServerApi
= StaticApi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment