dadi/web

Process middleware before handling static assets

adamkdean opened this issue · 1 comments

I wrote some middleware plugins for handling scss->css, js->better js etc, but found that they weren't working once the files were compiled. It turns out that public assets are served (1) before middleware is loaded (2) which means you're unable to do anything before it is served for these requests.

I think that we should be handling middleware first, so that security protocols, preprocessing etc, can be applied. Thoughts?

(1) https://github.com/dadi/web/blob/develop/dadi/lib/index.js#L240-L243
(2) https://github.com/dadi/web/blob/develop/dadi/lib/index.js#L274-L279

For some reason I always pick the API label. It must be the colour.