Node.js is one of the most adopted web development technologies but it lacks support for machine learning, deep learning and artificial intelligence libraries. Luckily, Python supports all these and many more other features. Django Framework for Python can utilize this functionality of Python and can provide support for building new age web application using machine learning and Artificial Intelligence.
For those developers who are not familiar with Django Framework but use Node JS framework can also benefit from Python using child process module for Node JS.
child_process.spawn(): This method helps us to spawn child process asynchronously.
Let’s create a simple Python script that will take two command line arguments as a first name and last name then display them. Later we’ll run that script from Node JS application and display output in the browser window.
Python script :
Node JS server code :
After saving the Python script and server script code, run the code from its source folder by following command :
Access the application through link :
localhost:3000/name?firstname="Enter first name"&lastname="Enter last name" For e g. : localhost:3000/name?firstname=Ram&lastname=Sharma
- This method can be used in alternative to REST-APIs.
- Machine learning modules can be implemented in Python and then utilize them in web app using this method.
- Creating child process using fork() in Python
- Communication between Parent and Child process using pipe in Python
- Autorun a Python script on windows startup
- Python script to open a Google Map location on clipboard
- Java Script | setTimeout() & setInterval() Method
- Web-Socket in NodeJS
- Introduction to NodeJS
- Nodejs | Web Crawling using Cheerio
- Cowsay in Nodejs using Requests library
- Nodejs - Connect MongoDB with Node app using MongooseJS
- Implementing Artificial Neural Network training process in Python
- HTML | script Tag
- HTML | DOM Script Object
- Measuring script execution time in PHP
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.