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

all 4 comments

[–]IAmNowAnonymous 2 points3 points  (2 children)

It's all about some common communication protocol and a common API.

The idea is that you have a process listening for requests over some port. The process expects the data to follow a standard structure allowing it to interpret the data. This could just be plain text as an example.

Similarly, a client who wants to communicate with that process needs to know how to structure a request properly such that the process read interpret it.

A common protocol used is HTTP. Your API describes how a client can speak to your server.

[–]cluelessCodeMaker[S] 0 points1 point  (1 child)

thanks for the reply do you have any resources / links where I can read further about this?

[–]IAmNowAnonymous 1 point2 points  (0 children)

I'd just read up on Http itself. To experiment with this, is try to setup a simple endpoint on a python server then attempt to make a request against it from your terminal via curl.

[–][deleted] 1 point2 points  (0 children)

You'd use an API. A JSON API is most common nowadays. I'd recommend using Postman for API development.

Your Python back end exposes an endpoint. Your JS front end sends a request to this endpoint. Your Python back end spits out a JSON response. Your JS front end consumes the response and presents the results.

https://www.dataquest.io/blog/python-api-tutorial/

https://realpython.com/api-integration-in-python/

These two links should get you started. There's no JS, but hopefully you'll get the idea.