reflex
reflex copied to clipboard
Document method to add backend api routes
Currently you can do something like this:
app = pc.App(state=MyState)
@app.api.get("/items/{item_id}")
async def api_test(item_id: int):
return {"my_result": item_id}
app.compile()
We can introduce a new method to allow this to be possible:
async def api_test(item_id: int):
return {"my_result": item_id}
app = pc.App(state=MyState)
app.api.add_api_route("/items/{item_id}", api_test)
app.compile()
EDIT: The above code already works, we just need to document it