Security is the biggest concern while building web applications. Most of the web applications handle a lot of sensitive data and it is necessary to provide adequate security to protect this data from perpetrators. This series of articles discuss various security issues, types of attacks and guidelines to be followed for building a  secure application. Front-end    The basic security features that should be implemented in every web applica...

While working with Node.js and Angular, sometimes you might need to set some custom values in Response Header from the server-side and get these values in your Angular application. These values can be some tokens, keys or anything. This article is about completing this requirement. Server-side using Express.js and Node.js To set a custom value in the response header, you have to write the following code in your Express.JS server [crayon-5da65ab1...

1 What is typescript? It is a strict syntactical superset of JavaScript, and adds optionaltype-checking along with the latest ECMAScript features. 2 What is two way data binding in angular? Two-way Binding. Data binding in AngularJS is the synchronization between the model and the view. When data in the model changes, the view reflects the change, and when data in the view changes, the model is updated as well. Binding   3 Types of bindings ...

While creating AngularJS applications,we might need to send multiple  http requests to backend apis to fetch the data that need to be populated within our HTML.In most cases, these backend apis might be protected using token .Also we might need to add a loading image to indicate the user that the data is being fetched. HttpInterceptor helps us to a display the loader image before and hide the loader image after completing the request  and also...

Angular 1.6 SPA server side pagination of data with sort. To create a SPA which lists user data with pagination  and sorting we need the following CDN links – Angular JS 1.6.9 js CDN. – Angular JS UI bootstrap -Bootstrap components written in pure AngularJS . – Bootstrap CSS file. STEP 1 – Create file index.html and add the relevant CDN links using the following codes. [crayon-5da65ab1a2099992013672/] STEP 2 – CREA...

HttpInterceptor –  feature in Angular 4.3. We may need to intercept Http request while building apps with Angular. Sometimes we may you need to intercept Http request to add something to request header or to do something with the response. We can use Http Interceptor to do some action when sending  a request.This can be achieved using  the following interceptor class which implemenets Httpinterceptor.The interceptor adds an ‘acces...

Node.js is an open source server environment which lets us write server side code in javascript. Node.js is asynchronous,single threaded and non-blocking .Node.js has very high memory efficiency which makes it very popular in server side  developement for web/mobile app.In this article we take a look at how to start of web developement in Node.js with Mysql as database. To install Node.js in your linux run the following command in the terminal [...

Filter function in javascript filters an array based on a given criteria and returns new array.For example if we want to get all elements in an array divisible by 2 as a new array,we can use filter function [crayon-5da65ab1a59b4740293209/] Just for a reference check what the map function gives in return [crayon-5da65ab1a59bf998430113/]   Now lets’s go back to filter function.Lets see how filter function works on array of objects. [cray...

  Javascript strings are immutable.But javascript objects and arrays are mutable.A mutable object is an object whose content can be modified after it is created. An immutable object is an object whose content cannot be modified after it is created. Consider an the following example [crayon-5da65ab1a6325780524817/] Now,from the above we realize that arrays and objects in javascript are mutable,ie they can be mutated. Functions like slice retu...

Angular is based on  component.It is having component within component architecture.Change detection look for changes in bindings from root to leaves from top to bottom. The library Zone.js lets Angular find out when to update the DOM. Angular performs change detection on component and child components when some changes occur in your App.But as the number of components increases change detection becomes heavy.In order to tackle this we can do...



Redis Tutorial Part 2 – Redis Sentinel and master/slave usage with Node.js ioredis

Redis Sentinel  System designed to help manage Redis instances. As we discussed earlier, one Redis instance can be master and other instances can be slaves. The slaves can have exact data copies of the master server. The master will have replication ID. The biggest advantage of this architecture is that the slave can act as a master if the master fails. Redis Sentinel is the system that helps to make Redis instances with High Availabil...

Redis Tutorial Part 1 – Introduction

Redis – Remote Dictionary Server Redis (Remote Dictionary Server) is an opensource key-value store. It can be used as a database, cache and message broker. Redis is an in-memory store which means that it primarily relies on main memory/primary memory for data storage in comparison to other database storages like Mysql that relies on disk storage.   Redis is written in C language and it supports cross-platform. In-memory dat...

Batch add to Google Cloud Firestore database collection : Node.js and Express
databases , Express.js , Node.js / March 17, 2019

STEP 1 – InitializeFirestore App To initializeFirestore, get the key file from your Google cloud console and save it in a folder. Install the Firebase admin module [crayon-5da65ab18f3e7008107485/] Now to initialize app, use the following code [crayon-5da65ab18f3f6375317066/] STEP 2 Create the  reference to the collection in which you are going to add the batch data [crayon-5da65ab18f3f9665956049/] STEP 3 Post batch data as an ar...

logging in Node.JS – Express Application using Winston logger
Express.js , Javascript , Node.js , Typescript / February 20, 2019

Logging is keeping a record of all data input, errors, data output, and final results in a program. While developing an application, keeping track of responses, requests, errors, etc makes the development process more efficient. Keeping logs is also a part of code standardization. Logs can be displayed on the console and written to a file while working with Node.js.Here in this tutorial, we will learn how to create create a logger wh...

Using Sequelize with typescript and express : Import all model files
Typescript , Uncategorized / February 17, 2019

STEP 1    Install Sequelize Install the latest version of Sequelize [crayon-5da65ab19089b112369168/] Now create your migration script STEP 2  Initialize your project To create an empty project you  need to run init command [crayon-5da65ab1908a2569107209/] This will create seeders, config, migrations and models folders Modify the configuration file in your config folder accordingly   Step 3 Create your model and migration file...

Extend Express Request and Response : Typescript Declaration Merging
Typescript / February 12, 2019

When we use  TypeScript to Build a Node API with Express, you might need to add some additional properties to the Express request and response object. To add extra properties to the request and response object you need to extend the response and request interface. index.d.ts files are used to provide typescript type information about a module that’s written in JavaScript.For express, the index.d.ts is present inside the @types/...

Environment variables and NodeJS Application – Linux
Uncategorized / February 11, 2019

The system environment is primarily the set of variables that define or control certain aspects of process execution. Environment variables help you differentiate between various environments in which your app is running and multiple apps in the environment can access these. Environment variables are system specific and are editable.   Environment variables help you to run your Node.js code in different environments like local/prod...

Knockout – A comparative study against AngularJS
Javascript , Knockout , Uncategorized / September 14, 2018

Knockout js is a Javascript library which follows MVVM(Model-View-ViewModel) architectural pattern. Unlike the AngularJS framework, the knockout is a library. The structuring of your application is entirely up to you when using KnockoutJS whereas the framework does it for you while using AngularJS. AngularJS follows MVC architectural pattern where Knockout follows the MVVM architectural pattern. The latest Angular frameworks from Angu...

Angular interview questions – part 1

1 What is typescript? It is a strict syntactical superset of JavaScript, and adds optionaltype-checking along with the latest ECMAScript features. 2 What is two way data binding in angular? Two-way Binding. Data binding in AngularJS is the synchronization between the model and the view. When data in the model changes, the view reflects the change, and when data in the view changes, the model is updated as well. Binding   3 Types of...

Top 10 Javascript interview questions : Concepts every javascript developer should know
interview questions , Javascript / August 20, 2018

1  Explain let,var and const variable declaration and explain their scope .what is strict mode? 2  What are callbacks and callback hell in javascript . What are higher order functions? 3 What is  hositing in javascript ? 4 What are prototypes and explain Prototypal inhertiance ? 5 What are Closures in javascript? 6 What are arrow functions / fat arrow functions  in Javascript? 7 What doe this keyword indicate in javascript? 8 What...