If you are programmer who have worked a long time with JavaScript you might know that , earlier JavaScript was just a scripting language used in the client side. However now the story is different. With many libraries like Node js and Express js being added to the JavaScript family JavaScript have evolved beyond, just being a scripting language in the client side. With these new libraries being added, now it is possible to build entire sites on JavaScript, extending it from front to back-end seamlessly. So what is Node and Express? Let's  clear this out step by step!
What is Node js?
Node js is an open source JavaScript runtime environment that executes JavaScript code server side. Node enables developers to use JavaScript for server side scripting. Node uses an event driven, non-blocking I/O model that makes it light weight and efficient. Because of this model Node js is particularly useful in web application that have many input/output operations and for real time web applications. Node is built on V8 engine , which is Chrome's JavaScript engine.
A key feature of Node is it's event loop. Whenever Node comes across a time consuming I/O operation, it registers this in the event loop and let it handle the operation. During the time event loop handles the I/O operation, the main thread can continue executing its other tasks. Once the event loop finish executing the task , it notifies this to the main thread using a callback. Having an event loop Node serves well for applications with heavy input/output operations, but not that efficient for applications with heavy computational tasks.
What is Express js?
Express is a web application framework for Node js. Like Node, Express is also open source and cross platform. Express is light weight and helps you to organize your web application into an MVC architecture on the server side.
Comparison
What is Node js?
Node js is an open source JavaScript runtime environment that executes JavaScript code server side. Node enables developers to use JavaScript for server side scripting. Node uses an event driven, non-blocking I/O model that makes it light weight and efficient. Because of this model Node js is particularly useful in web application that have many input/output operations and for real time web applications. Node is built on V8 engine , which is Chrome's JavaScript engine.
A key feature of Node is it's event loop. Whenever Node comes across a time consuming I/O operation, it registers this in the event loop and let it handle the operation. During the time event loop handles the I/O operation, the main thread can continue executing its other tasks. Once the event loop finish executing the task , it notifies this to the main thread using a callback. Having an event loop Node serves well for applications with heavy input/output operations, but not that efficient for applications with heavy computational tasks.
What is Express js?
Express is a web application framework for Node js. Like Node, Express is also open source and cross platform. Express is light weight and helps you to organize your web application into an MVC architecture on the server side.
Comparison
Node is a platform for building server side event-driven I/O applications using JavaScript, Express is a framework based on node js and makes it easier to work with node. To make it more clear , we can say that Node is like a programming language such as Java, C , C++,  etc., and Express is like a header file added to it.
Downloading and installing Node
1.Download: Download Node.js's package ecosystem, npm (node package manager). npm download
2.Run: Run the installer wizard.
3.Restart : Once installed, restart your PC to work with node.
4.Check: To check whether Node is successfully installed, open a command prompt and type 'node -v' . This will give you the node version installed to your PC.
5.Initialize: To initialize a node.js project directory, first make a folder in a preferred location. Open a command prompt inside your folder and type 'npm init' command. This will create a package.json file inside your folder. package.json is like a manifest file and contains a list of all the packages that our project depends on. An example is provided below.
6.Add Express: Add ExpressJS module to your project using the following command 'npm install express --save'.
After installing express module your package.json will look like this:
Downloading and installing Node
1.Download: Download Node.js's package ecosystem, npm (node package manager). npm download
2.Run: Run the installer wizard.
3.Restart : Once installed, restart your PC to work with node.
4.Check: To check whether Node is successfully installed, open a command prompt and type 'node -v' . This will give you the node version installed to your PC.
5.Initialize: To initialize a node.js project directory, first make a folder in a preferred location. Open a command prompt inside your folder and type 'npm init' command. This will create a package.json file inside your folder. package.json is like a manifest file and contains a list of all the packages that our project depends on. An example is provided below.
6.Add Express: Add ExpressJS module to your project using the following command 'npm install express --save'.
After installing express module your package.json will look like this:


Comments
Post a Comment