code4moldova/voluntar-backend

[code style]declare endpoints style

johnsmithm opened this issue · 0 comments

now we have in code two ways to declare endpoints, one way is in the app.py file, another is declaring endpoints inside a function like register function from requests.py


def register(app, auth):
    @app.route("/api/requests/filters/<page>/<per_page>", methods=["GET"])
    @auth.login_required
    def get_requests_by_filters(page=1, per_page=10):
        return requests_by_filters(request.args, page, per_page)

There is another way, using MethodView, but it is not used at all.
Let's discuss what style we select.