gzip middleware

tackles #3. Similar to @icholy's [solution](https://gist.github.com/icholy/7572468), but with some slight variations.