I'm trying to host the Swagger UI of Flask Restplus on Heroku server. It builds successfully and when checked in the logs of the heroku, even there it says "Build succeeded".
But the problem is when I check the actual hosting there's just a msg on the page saying
No API definition provided.
Btw the swagger-UI loads successfully on the browser when run locally.
Following is a sample code snipet for swagger-ui
from flask import Flask
from flask_restplus import Resource, Api
import os
app = Flask(__name__)
api = Api(app)
@api.route('/hello')
class HelloWorld(Resource):
def get(self):
return {'hello': 'world'}
if __name__ == '__main__':
port = int(os.environ.get("PORT", 5000))
app.run(host="0.0.0.0", port=port, debug=True)
So what am I doing wrong here? Is there any way that you can host a simple minimal flask_restplus swagger-UI on heroku ? Any help is appreciated, thanks.
EDIT
Following is the content of the swagger.json
{
"swagger": "2.0",
"basePath": "/",
"paths": {
"/hello": {
"get": {
"responses": {
"200": {
"description": "Success"
}
},
"operationId": "get_hello_world",
"tags": [
"default"
]
}
}
},
"info": {
"title": "API",
"version": "1.0"
},
"produces": [
"application/json"
],
"consumes": [
"application/json"
],
"tags": [
{
"name": "default",
"description": "Default namespace"
}
],
"responses": {
"ParseError": {
"description": "When a mask can't be parsed"
},
"MaskError": {
"description": "When any error occurs on mask"
}
}
}
Also if it helps, this is what's inside the Procfile
web: python app.py