reintroduce serveDirectory (to give some time to users to change their code), but deprecate it

This commit is contained in:
Alp Mestanogullari 2017-01-09 11:02:02 +01:00 committed by Oleg Grenrus
parent c655c6e474
commit 6d35f3d88f

View file

@ -11,6 +11,8 @@ module Servant.Utils.StaticFiles
, serveDirectoryFileServer
, serveDirectoryEmbedded
, serveDirectoryWith
, -- * Deprecated
serveDirectory
) where
import Data.ByteString (ByteString)
@ -49,8 +51,6 @@ serveDirectoryWebApp :: FilePath -> Server Raw
serveDirectoryWebApp = staticApp . defaultWebAppSettings . fixPath
-- | Same as 'serveDirectoryWebApp', but uses `defaultFileServerSettings`.
--
-- This used to be called 'serveDirectory' in @servant < 0.10@.
serveDirectoryFileServer :: FilePath -> Server Raw
serveDirectoryFileServer = staticApp . defaultFileServerSettings . fixPath
@ -70,6 +70,13 @@ serveDirectoryEmbedded files = staticApp (embeddedSettings files)
serveDirectoryWith :: StaticSettings -> Server Raw
serveDirectoryWith = staticApp
-- | Same as 'serveDirectoryFileServer'. It used to be the only
-- file serving function in servant pre-0.10 and will be kept
-- around for a few versions, but is deprecated.
serveDirectory :: FilePath -> Server Raw
serveDirectory = serveDirectoryFileServer
{-# DEPRECATED serveDirectory "Use serveDirectoryFileServer instead" #-}
fixPath :: FilePath -> FilePath
fixPath =
#if MIN_VERSION_wai_app_static(3,1,0)