Skip to content

Instantly share code, notes, and snippets.

@hiranya911
Last active August 27, 2018 05:56
Show Gist options
  • Save hiranya911/87889daacd35cf03a7248202e08e50c9 to your computer and use it in GitHub Desktop.
Save hiranya911/87889daacd35cf03a7248202e08e50c9 to your computer and use it in GitHub Desktop.
# File: main_emulate.py
import flask
from main import heroes
app = flask.Flask('functions')
methods = ['GET', 'POST', 'PUT', 'DELETE']
@app.route('/heroes', methods=methods)
@app.route('/heroes/<path>', methods=methods)
def catch_all(path=''):
flask.request.path = '/' + path
return heroes(flask.request)
if __name__ == '__main__':
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment