refactor and cli parsing

move api namespaces out of folders into core api namespace
setup cli parsing to give the option of running on a different port
refactor add-routes function