Skip to content

Commit 6d35f3d

Browse files
alpmestanphadej
authored andcommitted
reintroduce serveDirectory (to give some time to users to change their code), but deprecate it
1 parent c655c6e commit 6d35f3d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

servant-server/src/Servant/Utils/StaticFiles.hs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ module Servant.Utils.StaticFiles
1111
, serveDirectoryFileServer
1212
, serveDirectoryEmbedded
1313
, serveDirectoryWith
14+
, -- * Deprecated
15+
serveDirectory
1416
) where
1517

1618
import Data.ByteString (ByteString)
@@ -49,8 +51,6 @@ serveDirectoryWebApp :: FilePath -> Server Raw
4951
serveDirectoryWebApp = staticApp . defaultWebAppSettings . fixPath
5052

5153
-- | Same as 'serveDirectoryWebApp', but uses `defaultFileServerSettings`.
52-
--
53-
-- This used to be called 'serveDirectory' in @servant < 0.10@.
5454
serveDirectoryFileServer :: FilePath -> Server Raw
5555
serveDirectoryFileServer = staticApp . defaultFileServerSettings . fixPath
5656

@@ -70,6 +70,13 @@ serveDirectoryEmbedded files = staticApp (embeddedSettings files)
7070
serveDirectoryWith :: StaticSettings -> Server Raw
7171
serveDirectoryWith = 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+
7380
fixPath :: FilePath -> FilePath
7481
fixPath =
7582
#if MIN_VERSION_wai_app_static(3,1,0)

0 commit comments

Comments
 (0)