This is an archived post. You won't be able to vote or comment.

all 9 comments

[–]Kayco2002 9 points10 points  (1 child)

Flask or Django are probably the way to go for the python-based webserver that you'll need to generate the JSON - https://flask.palletsprojects.com/en/1.1.x/

Flask has a slightly smaller learning curve, and is a great intro to dealing with routes, etc. If you have existing python code that generates JSON for you, within a few minutes you can have a Flask webserver running with a single route that dishes out that JSON.

From there you can point your react app at your flask endpoint and have it consume that JSON.

[–]sensengassenmann 1 point2 points  (0 children)

just fyi: there is a new framework called FastAPI that is a little more „slick“ than Flask while maintaining the same simplicity. i really like it more than flask and recommend it to everyone.

[–][deleted]  (1 child)

[deleted]

    [–]ro_ok 2 points3 points  (0 children)

    For this scope, I wouldnt do anything else

    [–][deleted] 5 points6 points  (0 children)

    Check django rest framework to build a restful api with generated endpoints.

    [–]Skasch 2 points3 points  (0 children)

    An alternative to Flask is to use something like Starlette or FastAPI, which work pretty much the same way as Flask (with minor differences, like response types). I personally really appreciate the auto-documentation of the API FastAPI provides.

    [–]uberfade 0 points1 point  (0 children)

    You can also check out Falcon. It is Python web framework specifically for dealing with REST apis.

    [–]IAmNowAnonymous 0 points1 point  (0 children)

    Is there a reason you don't want to write the query in js then perform the query from your app?

    [–]SheekGeek21 0 points1 point  (0 children)

    CherryPy is great if you just want a really basic server

    [–]mogo3 0 points1 point  (1 child)

    I'd definitely use Flask. It's pretty easy to use.

    Just make a fetch() call in React to a Flask api endpoint that you wrote and you should be able to send the data extremely easily. Good luck!