@@ -18,7 +18,7 @@ module Servant.Utils.StaticFiles
18import Data.ByteString (ByteString)
18import Data.ByteString (ByteString)
19import Network.Wai.Application.Static
19import Network.Wai.Application.Static
20import Servant.API.Raw (Raw)
20import Servant.API.Raw (Raw)
21−import Servant.Server (Server, Tagged (..))
21+import Servant.Server (ServerT, Tagged (..))
22import System.FilePath (addTrailingPathSeparator)
22import System.FilePath (addTrailingPathSeparator)
23#if !MIN_VERSION_wai_app_static(3,1,0)
23#if !MIN_VERSION_wai_app_static(3,1,0)
24import Filesystem.Path.CurrentOS (decodeString)
24import Filesystem.Path.CurrentOS (decodeString)
@@ -47,33 +47,33 @@ import WaiAppStatic.Storage.Filesystem (ETagLookup)
47-- in order.
47-- in order.
49-- Corresponds to the `defaultWebAppSettings` `StaticSettings` value.
49-- Corresponds to the `defaultWebAppSettings` `StaticSettings` value.
50−serveDirectoryWebApp :: FilePath -> Server Raw
50+serveDirectoryWebApp :: FilePath -> ServerT Raw m
51serveDirectoryWebApp = serveDirectoryWith . defaultWebAppSettings . fixPath
51serveDirectoryWebApp = serveDirectoryWith . defaultWebAppSettings . fixPath
53-- | Same as 'serveDirectoryWebApp', but uses `defaultFileServerSettings`.
53-- | Same as 'serveDirectoryWebApp', but uses `defaultFileServerSettings`.
54−serveDirectoryFileServer :: FilePath -> Server Raw
54+serveDirectoryFileServer :: FilePath -> ServerT Raw m
55serveDirectoryFileServer = serveDirectoryWith . defaultFileServerSettings . fixPath
55serveDirectoryFileServer = serveDirectoryWith . defaultFileServerSettings . fixPath
57-- | Same as 'serveDirectoryWebApp', but uses 'webAppSettingsWithLookup'.
57-- | Same as 'serveDirectoryWebApp', but uses 'webAppSettingsWithLookup'.
58−serveDirectoryWebAppLookup :: ETagLookup -> FilePath -> Server Raw
58+serveDirectoryWebAppLookup :: ETagLookup -> FilePath -> ServerT Raw m
59serveDirectoryWebAppLookup etag =
59serveDirectoryWebAppLookup etag =
60 serveDirectoryWith . flip webAppSettingsWithLookup etag . fixPath
60 serveDirectoryWith . flip webAppSettingsWithLookup etag . fixPath
62-- | Uses 'embeddedSettings'.
62-- | Uses 'embeddedSettings'.
63−serveDirectoryEmbedded :: [(FilePath, ByteString)] -> Server Raw
63+serveDirectoryEmbedded :: [(FilePath, ByteString)] -> ServerT Raw m
64serveDirectoryEmbedded files = serveDirectoryWith (embeddedSettings files)
64serveDirectoryEmbedded files = serveDirectoryWith (embeddedSettings files)
66-- | Alias for 'staticApp'. Lets you serve a directory
66-- | Alias for 'staticApp'. Lets you serve a directory
67-- with arbitrary 'StaticSettings'. Useful when you want
67-- with arbitrary 'StaticSettings'. Useful when you want
68-- particular settings not covered by the four other
68-- particular settings not covered by the four other
69-- variants. This is the most flexible method.
69-- variants. This is the most flexible method.
70−serveDirectoryWith :: StaticSettings -> Server Raw
70+serveDirectoryWith :: StaticSettings -> ServerT Raw m
71serveDirectoryWith = Tagged . staticApp
71serveDirectoryWith = Tagged . staticApp
73-- | Same as 'serveDirectoryFileServer'. It used to be the only
73-- | Same as 'serveDirectoryFileServer'. It used to be the only
74-- file serving function in servant pre-0.10 and will be kept
74-- file serving function in servant pre-0.10 and will be kept
75-- around for a few versions, but is deprecated.
75-- around for a few versions, but is deprecated.
76−serveDirectory :: FilePath -> Server Raw
76+serveDirectory :: FilePath -> ServerT Raw m
77serveDirectory = serveDirectoryFileServer
77serveDirectory = serveDirectoryFileServer
78{-# DEPRECATED serveDirectory "Use serveDirectoryFileServer instead" #-}
78{-# DEPRECATED serveDirectory "Use serveDirectoryFileServer instead" #-}