summaryrefslogtreecommitdiffstats
path: root/legacy/api/cmd
diff options
context:
space:
mode:
authorAkhil Batra <akhil.batra@research.iiit.ac.in>2017-02-18 15:45:02 +0530
committerAkhil Batra <akhil.batra@research.iiit.ac.in>2017-02-19 11:50:58 +0530
commitf8949b5139f5829b60f361896d5be5f6b7801554 (patch)
tree087653917851dddbda9aaee89c2b0a734956d96d /legacy/api/cmd
parent93421c6375a450baa7bedb323e36b5efd238a58d (diff)
Move api server to legacy code.
Change-Id: Idda8a48bc8cecac5aff4a1f99b8e4e0b58855fff Signed-off-by: Akhil Batra <akhil.batra@research.iiit.ac.in>
Diffstat (limited to 'legacy/api/cmd')
-rw-r--r--legacy/api/cmd/__init__.py0
-rw-r--r--legacy/api/cmd/server.py31
2 files changed, 31 insertions, 0 deletions
diff --git a/legacy/api/cmd/__init__.py b/legacy/api/cmd/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/legacy/api/cmd/__init__.py
diff --git a/legacy/api/cmd/server.py b/legacy/api/cmd/server.py
new file mode 100644
index 00000000..eea45ad3
--- /dev/null
+++ b/legacy/api/cmd/server.py
@@ -0,0 +1,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()