forensic-architecture/datasheet-server

Static assets middleware

Opened this issue · 0 comments

With the addition of sources in Timemap, it has become evident that ds-s would benefit from middleware that can serve static assets.

The infrastructure for middleware already exists, and a simple version of this could be easily written that just exposes the assets in some subdirectory at a given prefix on ds-s.

It would be good in general, however, for middleware to also be able to hook into blueprinter functions, so that it can modify not only the routes that are available on ds-s, but also the structure and nature of the data in certain blueprints. Specifically for static asset middleware, this would be useful to allow the middleware to prefix paths loaded from a datasheet with the appropriate domain name/prefix on ds-s, so that such information does not need to be 'hardcoded' into the sheets themselves. There would still be coupling between the datasheet and the static directory structure, as the pathnames of the static assets could not be dynamic--but it would prevent details of ds-s configuration--the prefix of static assets--from needing to be manually curated in the datsheet.