Initializer
init(bundle:publicDirectory:defaultFile:directoryAction:cachePolicy:)
Creates a new
FileMiddleware for a server contained in an Xcode Project.convenience init(bundle: Bundle, publicDirectory: String = "Public", defaultFile: String? = nil, directoryAction: FileMiddleware.DirectoryAction = .none, cachePolicy: FileMiddleware.CachePolicy = .browserDefault) throws
Parameters
bundleThe Bundle which contains the files to serve.
publicDirectoryThe public directory to serve files from.
defaultFileThe name of the default file to look for and serve if a request hits any public directory. Starting with
/implies an absolute path from the public directory root. Ifnil, no default files are served.directoryActionDetermines the action to take when the request doesn’t have a trailing slash but matches a directory.
Return Value
A fully qualified FileMiddleware if the given publicDirectory can be served, throws a BundleSetupError otherwise
Discussion
Important
Make sure the public directory you wish to serve files from is included in the Copy Bundle Resources build phase of your project