Prerequisites
- Node.js
v10installed - Python
v3available in thePATH - Browser supporting WebSockets
This is a simple example of a Node.js server with following features:
- Enabled WebSocket communication
- HTTP endpoint which runs
pythonscript synchronously and returns its output - WebSocket can run
pythonscript asynchronously and send output back in chunks - Simple
htmlpage with 2 buttons to execute above actions and 2 panes to see preview output
Following assumes you have python v3 installed and have it available in the PATH:
- Checkout this repository
git clone repository && cd repository_folder - Set Node.js version in terminal
nvm use- defined in.nvmrc - Install dependencies
npm i - Start server
npm startornode server.js
