@api.resource is used in blueprint that it is not working

Author: towelongCreated Jun 23, 2023Updated Jul 2, 2023

code like this

python
from flask_restful import Resource, Api
from flask import Blueprint

bar_bp = Blueprint("bar", __name__, url_prefix="/v1")

api = Api(bar_bp)


@api.resource('/foo')
class Bar(Resource):
    def get(self):
        return {"msg": "bar"}

and app.py

python
from app.resources import bar_bp


def create_app():
    _app = Flask(__name__)
 
    _app.register_blueprint(bar_bp)

    return _app

Source: flask-restful/flask-restful