def start(self, serve=[]):
<EOL>if type(serve) is str:<EOL><INDENT>serve = [serve]<EOL><DEDENT>elif type(serve) is list:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>if len(serve) == <NUM_LIT:0>:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>for api_name in serve:<EOL><INDENT>if api_name not in self.apis:<EOL><INDENT>raise Exception("<STR_LIT>" % (api_name, self.path_apis))<EOL><DEDENT><DEDENT>app = self.app<EOL>app.secret_key = os.urandom(<NUM_LIT>)<EOL>conf = get_config()<EOL>if hasattr(conf, '<STR_LIT>'):<EOL><INDENT>log.info("<STR_LIT>" % (<EOL>conf.jwt_issuer,<EOL>conf.jwt_audience,<EOL>conf.jwt_secret[<NUM_LIT:0>:<NUM_LIT:8>],<EOL>))<EOL><DEDENT>serve.append('<STR_LIT>')<EOL>compress = Compress()<EOL>compress.init_app(app)<EOL>not_persistent = []<EOL>for api_name in self.apis.keys():<EOL><INDENT>if api_name in serve:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>not_persistent.append(api_name)<EOL><DEDENT><DEDENT>for api_name, api_path in self.apis.items():<EOL><INDENT>host = None<EOL>port = None<EOL>if api_name in serve:<EOL><INDENT>host = self.host<EOL>port = self.port<EOL><DEDENT>do_persist = True if api_name not in not_persistent else False<EOL>local = True if api_name in serve else False<EOL>log.info("<STR_LIT>" % (api_name, api_path, do_persist))<EOL>ApiPool.add(<EOL>api_name,<EOL>yaml_path=api_path,<EOL>timeout=self.timeout,<EOL>error_callback=self.error_callback,<EOL>formats=self.formats,<EOL>do_persist=do_persist,<EOL>host=host,<EOL>port=port,<EOL>local=local,<EOL>)<EOL><DEDENT>ApiPool.merge()<EOL>for api_name in self.apis.keys():<EOL><INDENT>if api_name in serve:<EOL><INDENT>log.info("<STR_LIT>" % api_name)<EOL>api = getattr(ApiPool, api_name)<EOL>api.spawn_api(app, decorator=generate_crash_handler_decorator(self.error_decorator))<EOL><DEDENT><DEDENT>log.debug("<STR_LIT>" % '<STR_LIT:U+0020>'.join(sys.argv))<EOL>if '<STR_LIT>' in sys.argv[<NUM_LIT:0>].lower():<EOL><INDENT>log.info("<STR_LIT>")<EOL>return<EOL><DEDENT>monitor_init(app=app, config=conf)<EOL>if os.path.basename(sys.argv[<NUM_LIT:0>]) == '<STR_LIT>':<EOL><INDENT>log.info("<STR_LIT>")<EOL>return<EOL><DEDENT>app.debug = self.debug<EOL>app.run(host='<STR_LIT>', port=self.port)<EOL>
Load all apis, either as local apis served by the flask app, or as
        remote apis to be called from whithin the app's endpoints, then start
        the app server