summaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'main.py')
-rw-r--r--main.py19
1 files changed, 2 insertions, 17 deletions
diff --git a/main.py b/main.py
index a836c13..87e9c16 100644
--- a/main.py
+++ b/main.py
@@ -17,6 +17,7 @@ def create_app(test_config=None):
17 app.config['SWAGGER'] = { 17 app.config['SWAGGER'] = {
18 'title': 'Mat2 Web API', 18 'title': 'Mat2 Web API',
19 'version': '1.0.0', 19 'version': '1.0.0',
20 'basePath': '/api'
20 } 21 }
21 # optionally load settings from config.py 22 # optionally load settings from config.py
22 app.config.from_object('config') 23 app.config.from_object('config')
@@ -32,25 +33,9 @@ def create_app(test_config=None):
32 app.register_blueprint(frontend.routes) 33 app.register_blueprint(frontend.routes)
33 34
34 # Restful API hookup 35 # Restful API hookup
35 api = Api(app) 36 app.register_blueprint(rest_api.api_bp)
36 Swagger(app) 37 Swagger(app)
37 CORS(app, resources={r"/api/*": {"origins": utils.get_allow_origin_header_value()}}) 38 CORS(app, resources={r"/api/*": {"origins": utils.get_allow_origin_header_value()}})
38 api.add_resource(
39 rest_api.APIUpload,
40 '/api/upload',
41 resource_class_kwargs={'upload_folder': app.config['UPLOAD_FOLDER']}
42 )
43 api.add_resource(
44 rest_api.APIDownload,
45 '/api/download/<string:key>/<string:secret>/<string:filename>',
46 resource_class_kwargs={'upload_folder': app.config['UPLOAD_FOLDER']}
47 )
48 api.add_resource(
49 rest_api.APIBulkDownloadCreator,
50 '/api/download/bulk',
51 resource_class_kwargs={'upload_folder': app.config['UPLOAD_FOLDER']}
52 )
53 api.add_resource(rest_api.APISupportedExtensions, '/api/extension')
54 39
55 return app 40 return app
56 41