Don't do file I/O in constructors. The API should take a list of routes as an "optional" constructor argument.
original comment
The routes probably need a separate parser. Someone has to know about the actual json file. Currently the only API instance is created in the Command class (every time it's evoked, which is a separate issue). Command does not make sense to offer up the api configuration file. That should probably be handled by the clients as each Client could offer their own API. Limiting the number of routes to initial each time.
The routes probably need a separate parser. Someone has to know about the actual json file. Currently the only API instance is created in the
Command
class (every time it's evoked, which is a separate issue).Command
does not make sense to offer up the api configuration file. That should probably be handled by the clients as eachClient
could offer their ownAPI
. Limiting the number of routes to initial each time.