Skip to content

Instantly share code, notes, and snippets.

@juhosa
Created December 19, 2017 11:39
Show Gist options
  • Save juhosa/c7c05d878e039e058d8bc9b4e6f9dfae to your computer and use it in GitHub Desktop.
Save juhosa/c7c05d878e039e058d8bc9b4e6f9dfae to your computer and use it in GitHub Desktop.
from flask import Flask
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
class {{ resource_name }}(Resource):
def get(self):
return {'hello': 'world'}
{% if health_check == 'yes' %}
class HealthCheck(Resource):
def get(self):
return {}
{% endif %}
api.add_resource({{ resource_name }}, '/')
{% if health_check == 'yes' %}
api.add_resource(HealthCheck, '/health')
{% endif %}
if __name__ == '__main__':
app.run(debug = True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment