Applications that run on a computer (such as Python or Ruby) can access the functions of the operating system (such as reading and writing files or network communication), which is the difference. Or, in other words, computers are like a box of chocolates - you never know what you're gonna get!
However, it is inconvenient to not be able to access the functions of the OS at all, so the browser mediates limited access to the functions of the OS. Through this mediation, access to the camera and microphone is also enabled, and web conferences are now possible.
What is Node.js?
Node.js can be used not only for web applications, but also to create other types of applications. For example, you can create command line tools and desktop applications.
What is npm?
NPM is a handy tool when using Node.js. It's like Python's pip, Ruby's gem (RubyGems), Debian's apt, Mac's Homebrew, and Rust's cargo.
There's also yarn, but it's okay because it can do the same thing as npm. "Packages" are libraries and frameworks, like Vue, React, webpack, and jQuery.
If you want to use a library with Node.js, you can install it with npm, so you don't have to download a js file and write
<script src="xxx.js"></script>. It's like a magical package delivery service!
Why is everyone using Node.js?
Let's not talk about TypeScript this time.
Purpose 2: I want to create a web application.
You can make web applications with Node.js, just like you can with Ruby + Rails or Python + Django.
|Execution environment||Language||Web framework|
|Ruby||Ruby||Ruby on Rails ..vv|
Node.js is a programming language designed to build network applications that can handle large amounts of simultaneous connections. It takes on the role of a web server, receiving HTTP requests and processing them.
You can use Node.js instead of a typical web server (Apache or nginx), but often a configuration with Node.js and Apache or nginx as a reverse proxy is used because Node.js alone is not enough.
Purpose 3: I want to create applications for mobile/desktop.
Additionally, using Electron, you can create applications that handle the features of operating systems like Windows, Mac, Linux, etc. Furthermore, using Electron, you can create applications that run on different platforms such as Windows, Mac, Linux, etc. using the same code.
Desktop applications like Visual Studio Code, Slack, Discord, Twitch, Skype, etc. are created using Electron.
Purpose 4: Others
Node.js is used for various other purposes, like bundling website assets with webpack, converting Sass to CSS using node-sass, using testing tools like Jest and code validation tools like ESLint, setting up a development-friendly web server locally with webpack-dev-server, and building static sites with Gatsby. It's like a Swiss Army knife for web developers!
jQuery is now considered a historical relic, but it was born after Rails and Django (it is not easy to compare, but still). It shows how fast things are moving.
Finally, I hope that this article will answer common questions such as "Is Node.js not a web server? Why do I have to install it if I just want to write with ES2015?" that are often asked at the beginning.
Mình hy vọng bạn thích bài viết này và học thêm được điều gì đó mới.
Donate mình một ly cafe hoặc 1 cây bút bi để mình có thêm động lực cho ra nhiều bài viết hay và chất lượng hơn trong tương lai nhé. À mà nếu bạn có bất kỳ câu hỏi nào thì đừng ngại comment hoặc liên hệ mình qua: Zalo - 0374226770 hoặc Facebook. Mình xin cảm ơn.
Momo: NGUYỄN ANH TUẤN - 0374226770
TPBank: NGUYỄN ANH TUẤN - 0374226770 (hoặc 01681423001)
All Rights Reserved