reintroduce serveDirectory (to give some time to users to change their code), but deprecate it
This commit is contained in:
parent
c655c6e474
commit
6d35f3d88f
1 changed files with 9 additions and 2 deletions
|
@ -11,6 +11,8 @@ module Servant.Utils.StaticFiles
|
||||||
, serveDirectoryFileServer
|
, serveDirectoryFileServer
|
||||||
, serveDirectoryEmbedded
|
, serveDirectoryEmbedded
|
||||||
, serveDirectoryWith
|
, serveDirectoryWith
|
||||||
|
, -- * Deprecated
|
||||||
|
serveDirectory
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Data.ByteString (ByteString)
|
import Data.ByteString (ByteString)
|
||||||
|
@ -49,8 +51,6 @@ serveDirectoryWebApp :: FilePath -> Server Raw
|
||||||
serveDirectoryWebApp = staticApp . defaultWebAppSettings . fixPath
|
serveDirectoryWebApp = staticApp . defaultWebAppSettings . fixPath
|
||||||
|
|
||||||
-- | Same as 'serveDirectoryWebApp', but uses `defaultFileServerSettings`.
|
-- | Same as 'serveDirectoryWebApp', but uses `defaultFileServerSettings`.
|
||||||
--
|
|
||||||
-- This used to be called 'serveDirectory' in @servant < 0.10@.
|
|
||||||
serveDirectoryFileServer :: FilePath -> Server Raw
|
serveDirectoryFileServer :: FilePath -> Server Raw
|
||||||
serveDirectoryFileServer = staticApp . defaultFileServerSettings . fixPath
|
serveDirectoryFileServer = staticApp . defaultFileServerSettings . fixPath
|
||||||
|
|
||||||
|
@ -70,6 +70,13 @@ serveDirectoryEmbedded files = staticApp (embeddedSettings files)
|
||||||
serveDirectoryWith :: StaticSettings -> Server Raw
|
serveDirectoryWith :: StaticSettings -> Server Raw
|
||||||
serveDirectoryWith = staticApp
|
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 :: FilePath -> FilePath
|
||||||
fixPath =
|
fixPath =
|
||||||
#if MIN_VERSION_wai_app_static(3,1,0)
|
#if MIN_VERSION_wai_app_static(3,1,0)
|
||||||
|
|
Loading…
Reference in a new issue