Add middleware

To address:

https://github.com/scottcorgan/pushstate-server/issues/2

Feedback welcome!