Split off the API into a new module
Review Request #9773 — Created March 13, 2018 and submitted
This patch splits off everything off the last bit of RB Gateway (except
for the main loop) into a package. There are also a few minor cleanups
related to middleware use.
Ran unit tests.