Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 41
Fast API
Beau Barker edited this page Jul 29, 2025
·
2 revisions
FastAPI server.
importuvicornfromfastapiimportFastAPI, Request, ResponsefromjsonrpcserverimportResult, Success, dispatch, methodapp=FastAPI()
@methoddefping() ->Result:
"""JSON-RPC method"""returnSuccess("pong")
@app.post("/")asyncdefindex(request: Request) ->Response:
"""Handle FastAPI request"""returnResponse(dispatch(awaitrequest.body()))
if__name__=="__main__":
uvicorn.run(app, port=5000)Reference: JSON-RPC in Fast API.
Contributions are appreciated – simply hit Edit or New page.