Created
July 11, 2013 05:03
-
-
Save snoyberg/5972643 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
module FileViewer where | |
import Control.Concurrent (forkIO) | |
import Control.Monad (void) | |
import Network.Wai.Application.Static (defaultFileServerSettings, | |
staticApp) | |
import Network.Wai.Handler.Warp (run) | |
import Prelude (IO, read, ($)) | |
import System.Environment (getEnv) | |
fileViewer :: IO a -> IO () | |
fileViewer action = do | |
void $ forkIO $ void action | |
portS <- getEnv "PORT" | |
let port = read portS | |
run port $ staticApp $ defaultFileServerSettings "." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment