The difference between node.js and express.js in the level of abstraction:
-> Node.js is a platform for building server-side event-driven i/o application using javascript.
-> Express.js is a framework based on node.js for building web-application using principles and approaches of node.js
Also Read:- Uploading files with ReactJS and NodeJS
NodeJS
Node.js takes a different approach. It runs a single-threaded event loop registered with the system to handle connections, and each new connection causes a JavaScript callback function to fire. The callback function can handle requests with non-blocking I/O calls, and if necessary can spawn threads from a pool to execute blocking or CPU-intensive operations and to load-balance across CPU cores. Node’s approach to scaling with callback functions requires less memory to handle more connections than most competitive architectures that scale with threads, including Apache HTTP Server, the various Java application servers, IIS and ASP.NET, and Ruby on Rails.
Node.js turns out to be quite useful for desktop applications in addition to servers. Also note that Node applications aren’t limited to pure JavaScript. You can use any language that transpiles to JavaScript, for example TypeScript and CoffeeScript. Node.js incorporates the Google Chrome V8 JavaScript engine, which supports ECMAScript 2015 (ES6) syntax without any need for an ES6-to-ES5 transpiler such as Babel.
Also Read:- How to build Snake using only JavaScript, HTML & CSS: Think like a Developer
Some JavaScript history
In 1995 Brendan Eich, then a contractor to Netscape, created the JavaScript language to run in Web browsers?—?in 10 days, as the story goes. JavaScript was initially intended to enable animations and other manipulations of the browser document object model (DOM). A version of JavaScript for the Netscape Enterprise Server was introduced shortly afterwards.
The name JavaScript was chosen for marketing purposes, as Sun’s Java language was widely hyped at the time. In fact, the JavaScript language was actually based primarily on the Scheme and Self languages, with superficial Java-like semantics.
Initially, many programmers dismissed JavaScript as useless for “real work” because its interpreter ran an order of magnitude more slowly than compiled languages. That changed as several research efforts aimed at making JavaScript faster began to bear fruit. Most prominently, the open-source Google Chrome V8 JavaScript engine, which does just-in-time compilation, inlining, and dynamic code optimization, can actually outperform C++ code for some loads, and outperforms Python for most use cases.
Also Read:- How to count the occurrence / frequency of array elements in JavaScript
The JavaScript-based Node.js platform was introduced in 2009, by Ryan Dahl, for Linux and MacOS, as a more scalable alternative to the Apache HTTP Server. NPM, written by Isaac Schlueter, launched in 2010. A native Windows version of Node.js debuted in 2011.
Joyent owned, governed, and supported the Node.js development effort for many years. Since 2015, the Node.js project has belonged to the Node.js Foundation, governed by the foundation’s technical steering committee. Node.js has also been embraced as a Linux Foundation Collaborative Project.
ExpressJS
Express is a framework of Node.js that allows you to use several very useful and powerful features without having to reinvent the wheel, helps you organize your application’s routing and use any templating solution with minimal effort. It also allows for much better organization of your code. In my personal opinion, Express.js is the best Node.js framework but Meteor.js, Derby.js, Sails.js and Flatiron.js are some of the best alternatives. Especially Meteor which is more of a full stack framework is superb and can do quite impressive things with minimal effort.
Express.js is one of the backend components of the MEAN stack. It was released in 2010 and was sold to Node.js becoming its the most popular framework 4 years later. It builds on top of the base language to provide developers with a rich set of features commonly used in web and mobile applications. It is the de facto framework for Node.js, meaning in practice, most of the developers who use Node.js for backend development also use the Express.js framework.