Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

about append middleware to app #1092

Open
hastonewy opened this issue Dec 23, 2024 · 0 comments
Open

about append middleware to app #1092

hastonewy opened this issue Dec 23, 2024 · 0 comments

Comments

@hastonewy
Copy link

hastonewy commented Dec 23, 2024

code:

app=Robyn(__file__)

def route_config(app: Robyn):
    # register middleware
    @app.before_request()
    def fn_applymw(request):
        return mwprint_request(request)

""" append routes from config
    app.router.add_route(
        HttpMethod.GET, path, fnact, False, fnError, dependencies
    )
"""

route_config(app)

serverConfig={"host":"0.0.0.0","port":80}

app.start(
    host=serverConfig.get("host", "0.0.0.0"),
    port=serverConfig.get("port", 8080),
)

as my code and test,use @app.before_request() is a only way to add middleware.

is there any other way? for make the code for a website project using ...

etc ... need a document for Robyn module,class,function,args ... 's list and detail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant