This must be something really stupid. I just started playing with scotty and cannot get the static content served correctly.
import Network.HTTP.Types
import Web.Scotty
import qualified Data.Text as T
import Data.Monoid (mconcat)
import Data.Aeson (object, (.=))
import Network.Wai.Middleware.Static
main = scotty 3000 $ do
middleware $ staticPolicy (noDots >-> addBase "static")
get "/" $ file "index.html"
Pretty simple. That's what you find in a couple of scotty tutorials. But it does not work for some reason. Accessing via '/' in the browser gives me the 'file not found' thing. If I type '/index.html' at the browser - it works. But it is wrong! I want it to be accessible via '/' but not '/index.html'. It disregards the root and picks up the html file directly. How can I serve index.html via '/' root? There is not much info around and a couple tutorials that I found point to the above example or similar which does not work as expected.
I tried setting the headers to 'text/html' and what not ... No luck.