Skip to content

thekoolfunda/use-python-in-node

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

use-python-in-node

Prerequisites

  • Node.js v10 installed
  • Python v3 available in the PATH
  • Browser supporting WebSockets

About

Preview of sample app

This is a simple example of a Node.js server with following features:

  • Enabled WebSocket communication
  • HTTP endpoint which runs python script synchronously and returns its output
  • WebSocket can run python script asynchronously and send output back in chunks
  • Simple html page with 2 buttons to execute above actions and 2 panes to see preview output

Running locally

Following assumes you have python v3 installed and have it available in the PATH:

  • Checkout this repository git clone repository && cd repository_folder
  • cd server/
  • Set Node.js version in terminal nvm use - defined in .nvmrc
  • Install dependencies npm i
  • Start server npm start or node server.js

About

Example of Python script usage in Node.js with sync/async output rendering in HTML

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 54.1%
  • JavaScript 31.9%
  • Python 14.0%