Node.js Articles

Found 212 articles

How to communicate JSON data between Python and Node.js?

Niharika Aitam
Niharika Aitam
Updated on 27-Mar-2026 737 Views

JSON (JavaScript Object Notation) is a lightweight text-based format for transferring and storing data between different programming languages. Python provides built-in JSON support through the json module, while Node.js has native JSON parsing capabilities. To communicate JSON data between Python and Node.js, we typically use HTTP requests where one service acts as a server and the other as a client. This enables seamless data exchange between the two platforms. Installing Required Dependencies For Python, install Flask to create a web server: pip install flask requests For Node.js, install the request-promise module: ...

Read More

How to share code between Node.js and the browser?

Rushi Javiya
Rushi Javiya
Updated on 15-Mar-2026 1K+ Views

Sharing code between the backend and front end of a full-stack application can be a challenging task. However, it's essential for building maintainable and scalable applications. By sharing code, we can avoid code duplication, reduce development time, and maintain consistency across our applications. In this tutorial, we'll explore different techniques for sharing code between Node.js and the browser and learn how to choose the best approach for our project. Techniques for Sharing Code Between Node.js and the Browser Users can follow the approaches below to share code between Node.js and the browser: CommonJS Modules CommonJS ...

Read More

Building Microservices with JavaScript and Node.js

Mukul Latiyan
Mukul Latiyan
Updated on 15-Mar-2026 794 Views

In the rapidly evolving world of software development, the demand for scalable and maintainable applications has grown exponentially. To meet these challenges, microservices architecture has emerged as a popular solution. With the powerful combination of JavaScript and Node.js, developers have a flexible platform at their disposal for building microservices. In this article, we will delve deeper into the fundamentals of microservices, discuss key concepts, and provide practical code examples using JavaScript and Node.js. Understanding Microservices Architecture Microservices architecture is an architectural style in which applications are built as a collection of loosely coupled, independently deployable services. Each service ...

Read More

Explain Passport in Node.js?

Rushi Javiya
Rushi Javiya
Updated on 15-Mar-2026 2K+ Views

Passport is a popular Node.js authentication middleware that provides flexible authentication strategies. It handles user authentication, password encryption, and session management with minimal code complexity. Passport offers over 500 authentication strategies including local authentication, OAuth (Google, Facebook), JWT tokens, and more. It integrates seamlessly with Express.js and popular databases like MongoDB. Key Features Authentication Strategies: Passport supports multiple authentication methods through strategy plugins. The most common is passport-local for username/password authentication. Password Security: Automatically handles password hashing and verification using secure algorithms, protecting user credentials from being stored in plain text. Session Management: Maintains user ...

Read More

crypto.createDiffieHellman(primeLength, [generator]) Method in Node.js

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 145 Views

The crypto.createDiffieHellman(primeLength, [generator]) method creates a Diffie-Hellman key exchange object by generating a prime number of specified bit length. This is commonly used for secure key exchange between parties. Syntax crypto.createDiffieHellman(primeLength, [generator]) Parameters The parameters are described below: primeLength – The number of prime bits to generate. Must be a number. generator – Optional generator for creating the exchange key object. ...

Read More

agent.createConnection() Method in Node.js

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 858 Views

The agent.createConnection() method is an interface provided by the Node.js http module. This method produces a socket/stream that can be used for HTTP requests. You can override this method in custom agents for greater flexibility. A socket/stream can be returned either directly from this function or by passing it to the callback. Syntax agent.createConnection(options, [callback]) Parameters The above function accepts the following parameters: options – These options contain the connection details for which the stream has to be created. ...

Read More

crypto.randomBytes() Method in Node.js

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 4K+ Views

The crypto.randomBytes() method generates cryptographically strong pseudo-random data in Node.js. This method ensures sufficient entropy before completion, typically taking only a few milliseconds to generate secure random bytes. Syntax crypto.randomBytes(size, [callback]) Parameters The parameters are described below: size – Specifies the number of bytes to generate. Must not exceed 2**31 - 1. callback – Optional callback function called if an error occurs. If omitted, the method runs synchronously. Asynchronous Example ...

Read More

Creating an Agent in Node.js

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 1K+ Views

In Node.js, an HTTP Agent manages connection pooling for HTTP client requests. You can create a custom agent using the new Agent() constructor to control connection behavior like keep-alive settings and socket limits. Syntax new http.Agent({options}) Parameters The Agent constructor accepts an options object with the following configurable properties: keepAlive – Keeps sockets open for reuse instead of closing them after each request. Default: false ...

Read More

crypto.getCurves() Method in Node.js

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 371 Views

The crypto.getCurves() method returns an array containing names of all supported elliptic curves in Node.js. These curves are used for creating Elliptic Curve Diffie-Hellman (ECDH) key exchange objects for secure cryptographic operations. Syntax crypto.getCurves() Parameters This method takes no parameters since it returns a complete list of all available elliptic curves. Return Value Returns an array of strings, where each string represents the name of a supported elliptic curve. Example Here's how to use crypto.getCurves() to retrieve all available elliptic curves: // Importing the crypto module const crypto ...

Read More

Logging in Node.js

Mayank Agarwal
Mayank Agarwal
Updated on 15-Mar-2026 464 Views

Logging is a very essential part in any application whether it is made in Node.js or any other programming languages. Logging helps us to detect weird behaviours of an application along with real-time errors and exceptions. One should definitely put logical logs in their application. These logs help the user to identify any mistakes and resolve it on urgent basis. There are 5 different log levels which are present at the moment with the user. These log levels are used to define different kinds of logs and helps the user to identify different scenarios. The log levels must be ...

Read More
Showing 1–10 of 212 articles
« Prev 1 2 3 4 5 22 Next »
Advertisements