What is Node.js?
Why use Node.js?
Node.js can do what other server side coding languages can do. It’s used for:
- File handling – create, read, open, write, delete, update and close files on the server
- Node.js can generate dynamic page content
- Process form data
- Node.js can also work with a database like MySQL to create a database driven website
Node.js Vs PHP – File Handling
|Send a task to the OS’s operating systems file system||Send a task to the OS’s operating systems file system|
|Ready to handle the next request||Waits for the file to open and then read the file|
|Once the file system has opened and the file read, the content is returned to the client||Returns the content to the client|
|Ready to handle the next request|
Node.js doesn’t wait for the processing to be done before moving onto the next request. It runs asynchronously which makes it perform better and more efficient with memory.
Node.js for development
Node.js is also widely used for automating development functionality and is used in conjunction with Gulp.js, WebPack and other task managers which will be covered in other tutorials.
You can install node.js by downloading it to your computer and following the easy to follow prompts. Download Node.js
WordPress Theme Development Project with Node.js and Gulp
You can checkout code that I use on one of my projects called DevWP for WordPress Theme Development with Node and Gulp.