Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from flask import Flask, Blueprint, jsonify
- from utils import NLogger
- logger = NLogger.create_logger('nimbus.api_service')
- class ApiService(service.Service):
- def __init__(self, app_factory):
- self.app_factory = app_factory
- self.web_app = Flask(__name__)
- self.api_bp = Blueprint('api', __name__)
- self.config = Config.to_dict()
- @inlineCallbacks
- def startService(self):
- logger.info("Starting web api service")
- yield self.setup_routes()
- yield self.setup_web_server()
- def stopService(self):
- pass
- @inlineCallbacks
- def setup_web_server(self):
- yield self.web_app.register_blueprint(self.api_bp, url_prefix='/api')
- yield self.web_app.run('127.0.0.1', 8081)
- """ ROUTER """
- def setup_routes(self):
- @self.api_bp.route('/test', methods=['GET'])
- def test():
- return "xd"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement