mike/public

  Source   Edit

This module provides the [servePublic] macro that enables you to serve all files inside a folder. You can also compile your application with -d:mikeStaticFiles or pass staticFiles = true to [servePublic] to make all the files be included in your binary so you don't need to deploy the files seperatly from the binary

Macros

macro servePublic(folder, path: static[string];
                  renames: openArray[(string, string)] = [];
                  staticFiles: static[bool] = defined(mikeStaticFiles))
Serves files requested from path. If staticFiles is true or the file is compiled with -d:mikeStaticFiles

Example: cmd: -r:off

import mike
servePublic("public/", "/static")
# Files inside public folder are now accessible at static/
# e.g. index.html inside public/ will be at url http://localhost/static/index.html

# You can also rename files so they can be accepted at a different path
servePublic("/", "/static", renames = {
  "": "index.html" # / will return /static/index.html (If no other handler handles it)
})
  Source   Edit