git.iko.soy/typeable/servant
on master help sign in
reintroduce serveDirectory (to give some time to users to change their code), but deprecate it
commit6d35f3d88f0c43d3ca426e7493e7d5af69df66b9 authorAlp Mestanogullari <alpmestan@gmail.com> dateMon 9 Jan 2017, 11:02 (10 years ago) parentc655c6e
1 file changed+9−2
servant-server/src/Servant/Utils/StaticFiles.hs+9−2
servant-server/src/Servant/Utils/StaticFiles.hs+9−2
@@ -11,6 +11,8 @@ module Servant.Utils.StaticFiles
1111 , serveDirectoryFileServer
1212 , serveDirectoryEmbedded
1313 , serveDirectoryWith
14+ , -- * Deprecated
15+ serveDirectory
1416 ) where
1517
1618import Data.ByteString (ByteString)
@@ -49,8 +51,6 @@ serveDirectoryWebApp :: FilePath -> Server Raw
4951serveDirectoryWebApp = staticApp . defaultWebAppSettings . fixPath
5052
5153-- | Same as 'serveDirectoryWebApp', but uses `defaultFileServerSettings`.
52−--
53−-- This used to be called 'serveDirectory' in @servant < 0.10@.
5454serveDirectoryFileServer :: FilePath -> Server Raw
5555serveDirectoryFileServer = staticApp . defaultFileServerSettings . fixPath
5656
@@ -70,6 +70,13 @@ serveDirectoryEmbedded files = staticApp (embeddedSettings files)
7070serveDirectoryWith :: StaticSettings -> Server Raw
7171serveDirectoryWith = staticApp
7272
73+-- | Same as 'serveDirectoryFileServer'. It used to be the only
74+-- file serving function in servant pre-0.10 and will be kept
75+-- around for a few versions, but is deprecated.
76+serveDirectory :: FilePath -> Server Raw
77+serveDirectory = serveDirectoryFileServer
78+{-# DEPRECATED serveDirectory "Use serveDirectoryFileServer instead" #-}
79+
7380fixPath :: FilePath -> FilePath
7481fixPath =
7582#if MIN_VERSION_wai_app_static(3,1,0)