-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtestapp.py
More file actions
executable file
·36 lines (28 loc) · 915 Bytes
/
testapp.py
File metadata and controls
executable file
·36 lines (28 loc) · 915 Bytes
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
32
33
34
35
36
from flask import Flask
from flask_restful import Resource, Api
from apispec import APISpec
from marshmallow import Schema, fields
from apispec.ext.marshmallow import MarshmallowPlugin
from flask_apispec.extension import FlaskApiSpec
from flask_apispec.views import MethodResource
from flask_apispec import marshal_with, doc, use_kwargs
app = Flask(__name__)
api = Api(app)
app.config.update({
'APISPEC_SPEC': APISpec(
title='Awesome Project',
version='v1',
plugins=[MarshmallowPlugin()],
openapi_version='2.0.0'
),
'APISPEC_SWAGGER_URL': '/swagger/',
'APISPEC_SWAGGER_UI_URL': '/swagger-ui/'
})
docs = FlaskApiSpec(app)
from endpoints import DemoAPI
api.add_resource(DemoAPI, '/demo')
docs.register(DemoAPI)
if __name__ == '__main__':
import os
port = int(os.environ.get('PORT', 12345))
app.run(debug=True, host='0.0.0.0', port=port)