Robyn
Robyn copied to clipboard
about append middleware to app
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 , sorry I missed this issue. I don't understand what you're asking tbh. Could you explain a bit more?