DEV Community

Cover image for Backend Concepts
S. M.  Mahmudur Rahman
S. M. Mahmudur Rahman

Posted on

Backend Concepts

What is Nodejs? Difference between Nodejs and javaScript
Or is Node js blocking or non-blocking?

Ans: Node.js is an extremely powerful framework developed on Chrome’s V8 JavaScript engine that compiles the JavaScript directly into the native machine code. It works on a single-threaded event loop and a non-blocking I/O which provides high rate as it can handle a higher number of concurrent requests.

It is a lightweight framework used for creating server-side web applications and extends JavaScript API to offer usual server-side functionalities. It is generally used for large-scale application development, especially for video streaming sites, single page application, and other web applications.

Difference between Nodejs and javaScript is given below:

JavaScript

  • Programming Language
  • Used for any client-side activity for a web application
  • Spider monkey (FireFox), JavaScript Core (Safari), V8 (Google Chrome), etc. are running engine

Node.js

  • Interpreter and environment for JavaScript
  • Used for accessing or performing any non-blocking operation of any operating system
  • V8 (Google Chrome) is running engine

How does Node.js work?

Ans:

Image description

  • Clients send requests to the webserver to interact with the web application. Requests can be non-blocking or blocking:
  • Querying for data
  • Deleting data
  • Updating the data
  • Node.js retrieves the incoming requests and adds those to the Event Queue
  • The requests are then passed one-by-one through the Event Loop. It checks if the requests are simple enough not to require any external resources
  • The Event Loop processes simple requests (non-blocking operations), such as I/O Polling, and returns the responses to the corresponding clients

A single thread from the Thread Pool is assigned to a single complex request. This thread is responsible for completing a particular blocking request by accessing external resources, such as computation, database, file system, etc.

Once the task is carried out completely, the response is sent to the Event Loop that sends that response back to the client.

What are the differences between SQL and NoSQL database?

Ans: Differences between sql and nosql database are given below:
SQL

  • Databases are categorized as Relational Database Management System (RDBMS).
  • SQL databases display data in form of tables so it is known as table-based database.
  • SQL databases are vertically scalable
  • SQL databases are best suited for complex queries.
  • MySQL, Oracle, Sqlite, PostgreSQL and MS-SQL etc. are the example of SQL database

NoSQL

  • NoSQL databases are categorized as Non-relational or distributed database system.
  • NoSQL databases display data as collection of key-value pair, documents, graph databases or wide-column stores.
  • NoSQL databases are horizontally scalable.
  • NoSQL databases are best suited for hierarchical data storage.
  • MongoDB, BigTable, Redis, RavenDB, Cassandra, Hbase, Neo4j, CouchDB etc. are the example of nosql database

Explain the concept of middleware in Node.js?

Ans: In general, middleware is a function receives the Request and Response objects. In other words, in an application’s request-response cycle these functions have access to various request & response objects along with the next function of the cycle. The next function of middleware is represented with the help of a variable, usually named next. Most commonly performed tasks by the middleware functions are:

  • Execute any type of code
  • Update or modify the request and the response objects
  • Finish the request-response cycle
  • Invoke the next middleware in the stack

What is ExpressJS?

Ans: Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications.

Top comments (1)

Collapse
 
wilsontrent profile image
WilsonTrent

that is amazing that you have choosing such type of content which are useful for us . love problem solution without money