summaryrefslogtreecommitdiffstats
path: root/legacy/api/cmd/server.py
blob: eea45ad35a03dda9e0cb0a6d5716d62b76678df4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
##############################################################################
# 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 legacy.api.router.mapper as mapper

app = Flask(__name__)
api = swagger.docs(Api(app), apiVersion='0.1', description='QTIP API specs')


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()