T <|> method HEAD) >> detectContentType f >> file f
{-# INLINE serveFile #-}

-- | Serve a file or directory
serveDirectory ∷ Bool -- ^ Allow file index for directories
               → FilePath -- ^ Path to the directory
               → B.By
serveFile ∷ FilePath -- ^ Path to file
          → B.ByteString -- ^ Routing path
          → Route Response
serveFile f p = fullPath p >> (method GET <|> method HEAD) >> detectContentType f >> file f
serveFile f p = fullPath p >> (method GET <|> method HEAD) >> detectContentType f >> file f