detect if running on the command line and setup routes for CLI