Best Online Tutorials

SQL Tutorial

Free SQL Tutorial

SQL Interview Questions

SQL Practice Questions

SQL Tips & Tricks

SQL Errors

SQL Books

Angular Tutorial

Free Angular Tutorial

Angular Interview Questions

Angular Practice Questions

Angular Tips & Tricks

Angular Errors

Angular Books

Node.js Tutorial

Free Node.js Tutorial

Node.js Interview Questions

Node.js Practice Questions

Node.js Tips & Tricks

Node.js Errors

Node.js Books

React.js Tutorial

Free React.js Tutorial

React.js Interview Questions

React.js Practice Questions

React.js Tips & Tricks

React.js Errors

React.js Books

SSIS Tutorial

Free SSIS Tutorial

SSIS Interview Questions

SSIS Practice Questions

SSIS Tips & Tricks

SSIS Errors

SSIS Books

SEO Tutorial

Free SEO Tutorial

SEO Interview Questions

SEO Practice Questions

SEO Tips & Tricks

SEO Errors

SEO Books

Javascript Tutorial

Free Javascript Tutorial

Javascript Interview Questions

Javascript Practice Questions

Javascript Tips & Tricks

Javascript Errors

Javascript Books

MongoDB Tutorial

Free MongoDB Tutorial

MongoDB Interview Questions

MongoDB Practice Questions

MongoDB Tips & Tricks

MongoDB Errors

MongoDB Books

Next.js Tutorial

Free Next.js Tutorial

Next.js Interview Questions

Next.js Practice Questions

Next.js Tips & Tricks

Next.js Errors

Next.js Books

Node.js Interview Questions and Answers | Part 10 

Prashant Surya  |   Jan 7, 2020  |  Views: 140


1.  Explain the purpose of ExpressJS package?

Express.js is a light-weight web application framework to help organize your web application into an MVC architecture on the server side.

2.  What is the use of NODE_ENV?

NODE_ENV is an environment variable used by the express webserver framework. 

When a node application is in run, you can check the value of the environment variable and do different things based on the value. 

NODE_ENV specifically is used to check whether a particular environment is a production or a development environment. 

Access using process:

Access using Express:

3.  How Many Types Of Streams Are Present In Node.Js?

There are four types of streams −

Readable − Stream which is used for read operation.
Writable − Stream which is used for write operation.
Duplex − Stream which can be used for both read and write operation.
Transform − A type of duplex stream where the output is computed based on input

4. Write a simple code to enable CORS in Node js?

CORS stands for Cross-Origin Resource Sharing. It a is a mechanism that uses additional HTTP headers to tell a browser to let a web application running at one origin (domain) have permission to access selected resources from a server at a different origin.

Use below code to enable CORS on NodeJS

app.use(function(req, res, next) {
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");

5. What do you understand by a test pyramid?

unit testing rule of thumb in Node.js,

The test pyramid describes that you should write unit tests, integration tests and end-to-end tests as well. You should have more integration tests than end-to-end tests, and even more unit tests.

6. What modules Used for Node.js Unit Testing

For unit testing, we are going to use the following modules:

test runner: mocha, alternatively tape
assertion library: chai, alternatively the assert module (for asserting)
test spies, stubs and mocks: sinon (for test setup).

 7.  List out some new features introduced in ES6?

Following are the list of few new Features introduced in ES6

  • const and let keywords
  • Array helper functions like map, forEach, filter, find, every, some, reduce
  • Arrow functions
  • Classes and enhanced object literals
  • Template strings
  • Default function arguments
  • Rest and spread operators
  • Promises
  • Modules
  • Multi-line Strings
  • Destructuring Assignment

 8. what is Closures?

A Closure is a function defined within another scope that has access to all the variables within the outer scope. Global variables can be made local (private) with closures.

9.  Why Zlib is used in Node js ?

Zlib is a module in Node.js responsible for compression and decompression (Like Zip and UnZip) functionality.

It does so by using Gzip and Deflate/Inflate, as well as Brotli.

The process of Compressing/decompressing a stream (such as a file) can be achieved by piping the source stream data through a zlib stream into a destination stream.

10. What IDEs Can You Use For Node.Js Development?

Visual Studio Code
Sublime Text
IntelliJ IDEA

Content Contributor
Prashant Surya

Prashant Surya

Software developer at Uniserve Data Technologies Pvt. Ltd.  |   Noida, Uttar Pradesh, India

I am a software developer, freelancer and trainer working on technologies likes. MEAN stack, MERN Stack, ASP.NET full stack, WebRTC, ,PWA, SQL, JavaScript, jQuery, HTML, CSS, SEO, responsive UI/UX designing... having 7 years of experience in development in multiple domains like, eCommerce, RTA, capital markets, education, real estate...

Read related articles

Node.js Interview Questions and Answers | Part 5

Pooja Goel  |   Dec 30, 2019  |  Views: 256

Node.js Interview Questions and Answers | Part 4

Pooja Goel  |   Dec 30, 2019  |  Views: 296

Node.js Interview Questions and Answers | Part 3

Pooja Goel  |   Dec 30, 2019  |  Views: 176

Node.js Interview Questions and Answers | Part 2

Pooja Goel  |   Dec 27, 2019  |  Views: 157

Node.js Interview Questions and Answers | Part 1

Pooja Goel  |   Dec 27, 2019  |  Views: 363

Want to sell your software ?-

If you want to sell your readymade software to the genuine clients or businessman, list your software with details and demo links.

  • Sell ERP
  • Sell Website Clones
  • Sell App Clones
  • Sell Readymade Portals
  • Sell Readymade Websites
  • Sell Mobile Apps
  • Sell Window Apps

Clients will find it using our advanced search filter and will contact you directly.

No any charge for the product lsiting.

Do you own a Company ?+

Buy or Sell Commercial Property+

Are you a freelancer ?+

Looking for a job ?+

Are you a Service Provider ?+

Are you a blogger ?+

Do you own an IT Institute ?+