Refactor static mount to make it testable

Includes style cleanup.

* rename `resp` to `res`
* `function (` to `function(`