Robyn icon indicating copy to clipboard operation
Robyn copied to clipboard

about append middleware to app

Open hastonewy opened this issue 1 year ago • 1 comments

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

hastonewy avatar Dec 23 '24 04:12 hastonewy

@hastonewy , sorry I missed this issue. I don't understand what you're asking tbh. Could you explain a bit more?

sansyrox avatar Jul 23 '25 11:07 sansyrox