Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

healeycodes/talking-between-python-and-js

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Talking to Python from JavaScript (and Back Again!)

This repository contains the tutorial code for my article on communicating between Python and JavaScript.


Desktop


Via JSON

A Flask web app with two routes. /test which serves a page with JavaScript that uses the Fetch API to GET JSON data from /hello, and then POSTs JSON data, also to /hello. Everything is logged to console.

Any issues with launching the Flask app should seek these docs, and the Flask home page for general installation instructions.


Via processes

There's also some files that demonstrate how processes can communicate via the stdout. Data is reported by a spawn process which is caught and collected. This is displayed in Python and Node.js. sensor.js, sensor.py, temperature-listener.js, temperature-listener.py. With the Node.js parent process, events are used. For the Python parent process we use a simple buffer and check for the newline char.


Hopefully this repository (combined with the article) will answer some beginner questions about how different languages 'talk' to each other! I'm accepting any PRs that bring further clarity or fix errors.


MIT license.

About

Talking to Python from JavaScript (and Back Again!)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.