Created
August 19, 2021 16:44
-
-
Save souravs17031999/27f37d1d7d7bf73a152c5f4575d92775 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, jsonify, request | |
from views.user import user | |
app = Flask(__name__) | |
app.register_blueprint(user, url_prefix='/user') | |
@app.before_request | |
def before_request_func(): | |
print("before_request is running!") | |
print("REQUEST METHOD: ", request.method) | |
print("REQUEST HEADERS: ", request.headers) | |
print("REQUEST PARAMS: ", request.args) | |
@app.after_request | |
def after_request(response): | |
print("RESPONSE STATUS: ", response.status) | |
print("RESPONSE HEADERS: ", response.headers) | |
print("RESPONSE BODY: ") | |
print(response.data, "\n") | |
return response | |
if __name__ == '__main__': | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment