I want to see files in my localhost directory using Kitura. I've written:
router.all("/test/*", middleware: StaticFileServer())
but it didn't seem to work
I want to all files in my directory. Similar to directoryIndex
I want to see files in my localhost directory using Kitura. I've written:
router.all("/test/*", middleware: StaticFileServer())
but it didn't seem to work
I want to all files in my directory. Similar to directoryIndex
You can pass the path to a directory to serve to
StaticFileServer, aspathparameter, by default it is"public":router.all("/test/", middleware: StaticFileServer(path: "MyDirectoryWithStaticFiles"))Then you will be able to access the files in this directory, but not the directory itself. E.g., you will be able to perform GET
/test/someFile.html, but not/test/. You will be able to GET/test/, if your directory will containindex.html.See https://github.com/IBM-Swift/Kitura-Sample for example of using
StaticFileHandler.