Introduction to Node js

Introduction to NodeJS:

Node JS is a packaged compilation of Google’s V8 JavaScript engine, the libuv platform abstraction layer, and a core library, which is itself primarily written in JavaScript. Node JS shines in real-time web applications employing push technology over web sockets. The main principle of Node JS: use non-blocking, event-driven I/O to remain lightweight and efficient in the face of data-intensive real-time applications that run across distributed devices. It replaces the traditional request-response paradigm with a fast, two-way communication model. It is asynchronous without the use of threads; it is not memory-intensive.‌

NODEJS API SEREVR

Restaurant Sass Backend are built using the core components of Node, Express, MongoDB, Passport JS. Restaurant Sass Backend has also been constantly incorporating various other latest technologies as needed.‌

MongoDB :

MongoDB's ability to store JavaScript objects natively saves time and processing power. Rather than storing your data in tables and rows as you would with a relational database, in MongoDB you store JSON-like documents with dynamic schemas. Instead of a domain-specific language like SQL, MongoDB utilizes a simple JavaScript interface for querying. Going through the documentation is as simple as passing a JavaScript object that partially describes the search target.‌

NODE JS :

Node JS is a packaged compilation of Google’s V8 JavaScript engine, the libuv platform abstraction layer, and a core library, which is itself primarily written in JavaScript. Node JS shines in real-time web applications employing push technology over web sockets. The main principle of Node JS: use non-blocking, event-driven I/O to remain lightweight and efficient in the face of data-intensive real-time applications that run across distributed devices. It replaces the traditional request-response paradigm with a fast, two-way communication model. It is asynchronous without the use of threads; it is not memory-intensive. Node JS web sockets run on TCP, not HTTP, so low-overhead client-server communication is enabled in both directions.‌

Ideally, if you are writing a mobile app, you want to cover all the bases – iOS, Android, and Windows – to obtain maximum market share or to grant your mobile workforce flexibility in device choice. A straightforward way to accomplish that is to write all the app’s logic in Node JS and place it on the backend. The user interface then runs on the mobile device under another language.‌

Express JS :

Express JS is server-side and mobile application framework, written in JavaScript. It builds single-page, multi-page, and hybrid mobile and web apps; Common back-end functions for web applications; APIs.‌

Express JS is a prebuilt Node JS framework that can help you in creating server-side web applications faster and smarter. Simplicity, minimalism, flexibility, scalability are some of its characteristics, and since it is made up of Node JS itself, it inherits its performance as well.‌

In short, Express JS did for Node JS what Bootstrap did for HTML/CSS and responsive web design. It made coding in Node JS a piece of cake and gave programmers some additional features to extend their server-side coding. Express JS is hands down the most famous Node JS framework - so much so that when most people talk about Node JS, they surely mean Node JS + Express JS.‌

Passport JS :

Passport is authentication middleware for Node JS. Extremely flexible and modular, Passport can be unobtrusively dropped into any Express-based application. The Passport recognizes that each application has unique authentication requirements. Authentication mechanisms, known as strategies, are packaged as individual modules. Applications can choose which strategies to employ, without creating unnecessary dependencies.‌

SocketIO :

Socket.IO is an event-based bi-directional communication layer for realtime web applications. It abstracts many modes of transport, including AJAX long-polling and WebSockets, into a single API. It allows developers to send and receive data without worrying about cross-browser compatibility. Socket.IO provides both server-side and client-side components with similar APIs.‌

  • On the server-side, Socket.IO works by adding event listeners to an instance of http.Server .

  • The HTTP server will begin to serve the client library at /socket.io/socket.io.js

Since both the server and client's Socket object act as EventEmitters you can emit and listen for events in a bi-directional manner.

It's has lots Advantage over Firebase Database . There no limitation on Query but can can apply any custom logic . There Setup and Server cost will be bit higher.