JavaScript is a programming language that is typically used in the browser to interact with the DOM, to manipulate items in a page loaded in the browser. For example, to open and close a popup, a modal to any other kind of effects. Because JavaScript is a language that runs on the browser, it becomes very crucial when building interactive user interfaces on the web.
However, JavaScript is not limited to web browsers alone, this is where NodeJs comes in. Node takes JavaScript and puts it in a different environment. We can basically say that Node is JavaScript on the Server. In theory, not just on the server but on any kind of machine.
In the browser, most of the time what you are doing is interacting with the DOM or other Web Platform APIs like Cookies. Those do not exist in Node.js, of course. You don’t have the document
or window
, and all the other objects that are provided by the browser.
And in the browser, we don’t have all the nice APIs that Node.js provides through its modules, like the file system
access functionality.
Another big difference is that in Node.js you control the environment. Unless you are building an open-source application that anyone can deploy anywhere, you know which version of Node.js you will run the application on. Compared to the browser environment, where you don’t get the luxury to choose what browser your visitors will use, this is very convenient.
This means that you can write all the modern ES6–7–8–9 JavaScript that your Node version supports which are not yet supported by all kinds of browsers.
Role of NodeJS in Software Development
- Create server
- Listening to incoming requests (request can be in various formats such as files, texts, JSON)
- Handle requests
- Validating users' input
- Connect to databases
- Process and return responses (response can be in various formats such as files, texts, JSON)
- and some more.
In my following articles, I would share links to any installation process and only focus on vital points I have learnt and discovered. Join me as we dive into the profundity of NodeJS.