Skip to content

File sources

Derek Clarkson edited this page Oct 8, 2023 · 2 revisions

In addition to serving responses from defined API endpoints Voodoo can also serve files from a directory based on the path.

This is most useful for things like image files where the path of the incoming request can be directly mapped onto the directory structure.

For example, http://127.0.0.1/8080/images/company/logo.jpg can be mapped to a file in Tests/files/images/company/logo.jpg.

To achieve this mapping add the VoodooServer initialiser argument filePaths: [URL(string: "Tests/files"]), or the voodoo command line argument --file-dir Tests/files.

To add multiple directories with voodoo just repeat the argument as many times as you need.

Clone this wiki locally