diff options
Diffstat (limited to 'qtip/api/cmd/server.py')
-rw-r--r-- | qtip/api/cmd/server.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/qtip/api/cmd/server.py b/qtip/api/cmd/server.py new file mode 100644 index 00000000..852073a7 --- /dev/null +++ b/qtip/api/cmd/server.py @@ -0,0 +1,30 @@ +############################################################################## +# Copyright (c) 2016 ZTE Corp and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +from flask import Flask +from flask_restful import Api +from flask_restful_swagger import swagger +import qtip.api.router.mapper as mapper + +app = Flask(__name__) +api = swagger.docs(Api(app), apiVersion='0.1') + + +def add_routers(): + for (handler, url) in mapper.mappers: + api.add_resource(handler, url) + + +def main(): + add_routers() + app.run(host='0.0.0.0') + + +if __name__ == "__main__": + main() |