-1

I had a requirement of migrating twisted to FastApi.

The old code was completely written in Python 2.7 and used JsonPrc along with twisted client.

Like - [https://stackoverflow.com/a/4738563][1]

Even the static content like html,css,js files used jsonprc to access the API calls. Like there is a complete index.html file which has dependency on html,css, js with jsonprc calls.

I have gone through some documents but couldn't come to conclusion.

Below were few links-

https://github.com/smagafurov/fastapi-jsonrpc

https://github.com/authorizon/fastapi_websocket_rpc

In these I cant see how to integrate html,css,js with jsonrpc. for eg., index.html

So I just want to know the approach to achieve my requirement.

Like websocket, jsonrpc or jinja Template ? Thanks

max
  • 7
  • 4

1 Answers1

0

Is your main issue to serve static files? FastApi has an easy dedicated solution for that: https://fastapi.tiangolo.com/tutorial/static-files/

microcosme
  • 703
  • 1
  • 5
  • 22
  • I have gone through the doc but my issue is to integrate html,css,js to integrate with API's using JSON RPC. In twisted we have used JSON RPC for server, client with html css js files. I couldn't conclude the way out of it. – max Apr 04 '22 at 17:44
  • https://github.com/authorizon/fastapi_websocket_rpc. Here I got some idea but need to conclude how to integrate this stuff with html,css,js like using jinja2 or something else is the question. – max Apr 04 '22 at 17:45
  • I tried with static files link you shared and it seems to be fine as expected. – max Apr 04 '22 at 19:14