[api] [http] [refactor] Export api as middleware without needing to call .start or .listen