Created
December 4, 2015 00:40
-
-
Save brianv0/b360fb93d653bb3cd0d4 to your computer and use it in GitHub Desktop.
Basic Flask App
This file contains hidden or 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 | |
| app = Flask(__name__) | |
| from toy import toy_blueprint | |
| app.register_blueprint(toy_blueprint) | |
| if __name__ == '__main__': | |
| app.run() |
This file contains hidden or 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 Blueprint, request, current_app, make_response | |
| toy_blueprint = Blueprint('toy', __name__) | |
| @toy_blueprint.route('/', methods=['GET']) | |
| def get_root(): | |
| return make_response("This is a free and clear response", 200) | |
| @toy_blueprint.route('/protected', methods=['GET']) | |
| def get_protected(): | |
| return make_response("This is a protected response", 200) | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
git clone https://gist.github.com/b360fb93d653bb3cd0d4.git mv b360fb93d653bb3cd0d4 toy cd toy