Permalink
Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (21 sloc) 509 Bytes
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.errorhandler(404)
def page_not_found(e):
return jsonify({
'code': '404',
'message': "URL not found"
}), 404
@app.route("/echo")
def hello():
echo = request.args.get('echo')
response = {
'hello': 'world',
'echo' : echo or ''
}
return jsonify(response)
@app.route('/docs')
def docs():
return app.send_static_file('docs.html')
if __name__ == '__main__':
app.run(debug=True)