(dev) cleaned up the api files a bit

Added better support for simple dependency injection to decouple
middleware and schema