Created
June 20, 2018 19:46
-
-
Save olawalejarvis/a0dc4a5e179a1569b10c682585db027e to your computer and use it in GitHub Desktop.
python_tutorial17
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
| #src/app.py | |
| from flask import Flask | |
| from .config import app_config | |
| from .models import db, bcrypt | |
| # import user_api blueprint | |
| from .views.UserView import user_api as user_blueprint # add this line | |
| def create_app(env_name): | |
| """ | |
| Create app | |
| """ | |
| # app initiliazation | |
| ##################### | |
| # existing code remain # | |
| ###################### | |
| app.register_blueprint(user_blueprint, url_prefix='/api/v1/users') # add this line | |
| @app.route('/', methods=['GET']) | |
| def index(): | |
| """ | |
| example endpoint | |
| """ | |
| return 'Congratulations! Your first endpoint is working' | |
| return app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment