Split off the API into a new module

Review Request #9773 — Created March 13, 2018 and submitted — Latest diff uploaded

Information

rb-gateway
master
b0832a0...

Reviewers

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.