Skip to content

Instantly share code, notes, and snippets.

@Profpatsch
Created December 9, 2016 23:40
Show Gist options
  • Save Profpatsch/a627cf285d3713680c692187804a5314 to your computer and use it in GitHub Desktop.
Save Profpatsch/a627cf285d3713680c692187804a5314 to your computer and use it in GitHub Desktop.
Like python’s SimpleHTTPServer, but using the fastest webserver on this planet instead.
#!/usr/bin/env nix-shell
#!nix-shell -i runhaskell -p "haskellPackages.ghcWithPackages (hps: with hps; [wai-middleware-static warp])"
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Network.Wai
import Network.Wai.Middleware.Static
import Network.Wai.Handler.Warp
import Network.HTTP.Types.Status
main =
runEnv 8000 $ static $ \req resp -> resp $ responseLBS notFound404 [] ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment