Efficient Code with JS functions

The craft of programming is the factoring of a set of requirements into a set of functions and data structures. Functions are one of the key components in programming. They are defined to perform a specific task and to perform it again and again whenever called. Simple and straightforward, right? The best thing about JavaScript is its implementation… Continue reading Efficient Code with JS functions

Shallow or Deep Copy?

Before going forward, let us understand Objects and references in JavaScript. What is an Object?? Object is a container of properties associated as key and value pairs. The values in an Object can be functions that are commonly referred to as methods. Object is created only once in JavaScript, and we can refer Object by… Continue reading Shallow or Deep Copy?

Inheritance in JS — Prototype and class Inheritance

Unlike all other object-oriented programming languages, JavaScript chose prototypes for its way of handling inheritance, but with the release of ES2015, classes were introduced to the language’s syntax. Let me put light on thought: Classes are just syntactic sugar, JavaScript remains prototype based. They are not a new object-oriented inheritance model. Let’s understand the Prototype first… Continue reading Inheritance in JS — Prototype and class Inheritance

What is the purpose of atob() and btoa() functions in JavaScript?

In JavaScript, atob and btoa are two built-in functions used for basic browser-side encoding and decoding between ASCII strings and base64-encoded binary data. atob(encodedString) Decodes a base64-encoded string (encodedString) and returns its decoded ASCII equivalent as a string. This function is useful for retrieving data that was previously encoded using btoa to store or transmit… Continue reading What is the purpose of atob() and btoa() functions in JavaScript?

How to display a file in new browser tab using a download link

If you have a link to a file that can be used to download any file stored in cloud storage, you can use the same to render the file in a new browser tab in JavaScript. Following is a sample script to do the same: getFilePreview(fileURL, fileType) {             console.log(“Inside… Continue reading How to display a file in new browser tab using a download link

Node Js GraphQL Basis

Install necessary packages like apollo-server-express and graphql using npm or yarn. Create a schema using the GraphQL Schema Definition Language (SDL). Define types, queries, mutations, and subscriptions. Write resolver functions to handle GraphQL queries, mutations, and subscriptions. Resolvers resolve the data for each field in the schema. Configure and start the Apollo Server with Express.… Continue reading Node Js GraphQL Basis

How to create a REST API with Node.js and Express

to create the REST APIS in the node application Creating a folder structure Open image-20240422-093737.png ├── config/ └── db.js ├── models/ └── Student.js ├── routes/ └── studentRoutes.js ├── controllers/ └── studentController.js ├── app.js └── package.json app.js File const express = require(‘express’) const app = express(); const Student = require(‘./models/student’) const mongoose = require(‘mongoose’); const studentRoutes… Continue reading How to create a REST API with Node.js and Express

Node Js Mobile OTP based authentication and authorization API using Nodejs and Mongodb

Dependencies 1) Express Js Express is a back end framework for Node.js.It is designed for building web applications and APIs. It has been called the de facto standard server framework for Node.js 2) Mongoose Mongoose is a Database ODM for Nodejs. It provide schema based api to model our mongodb schema.It is famous in world… Continue reading Node Js Mobile OTP based authentication and authorization API using Nodejs and Mongodb

what is the use of moment js in javascript?

Moment.js is a popular JavaScript library that simplifies working with dates and times. Here’s what it offers: Parsing: JavaScript’s built-in Date object can be finicky when parsing dates, especially in different formats (e.g., DD/MM/YYYY vs MM/DD/YYYY). Moment.js provides a consistent and robust way to parse dates from various strings, objects, and arrays. Manipulation: Moment.js allows… Continue reading what is the use of moment js in javascript?

Creating Simple Node js Application

Creation of a simple node js application Installation and connection with DB Basic Commands used for the installtion Starting the application To install a basic simple app for node firstly need to check the node version on the system If node is not installed check the following documents for the node installation Node.js — Download… Continue reading Creating Simple Node js Application