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-5d85b423...

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-5d85b4237fff1571708814/] 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-5d85b42383523084390517/] Just for a reference check what the map function gives in return [crayon-5d85b4238352b835517678/]   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-5d85b42383d34487598014/] 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...



Node.js – tools/packages/practices for building a secure,high performance API with quality code

Contents >Code standard and styling >Security >Performance         In this article, we will take a look at some important aspects to be considered while developing Node.js applications and the tools/packages/practices that can be used to achieve them. Understanding and using these will help you in building a secure web application that is well structured and well documented and has a very high performance. C...

Guidelines for building a secure Web application/Mobile application – Part 1 Front-end

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 w...

Check for duplicates in JavaScript Array of Objects
Express.js , Javascript , Uncategorized / July 28, 2019

How to check whether an Array of Objects contain duplicates by key Consider an Array of student Objects with each object having a key id. We have to perform a validation whether multiple objects with the same Id is present in the Array or not. [crayon-5d85b42359085157654783/] The above are Arrays of student Objects, one with duplicate id value and one without duplicate id value. To get the  Ids present in the Arrays we need to use the ...

Web Storage – A comparative study of Local Storage,Session Storage,Cookies,IndexedDB and WebSQL
databases , Javascript , Uncategorized / July 10, 2019

Storages in browsers – Web Storage Web Storage is the storage mechanism that allows Web applications to store data in Web Browsers. The various storage types include Local Storage, Session Storage, Cookies, IndexedDB, Web SQL. These storages are supported by most of the modern-day web browsers and are standardized by the World Wide Web Consortium. Web Storage lets a web application to store data which in turn helps in the effectiv...

Set and Get Custom Response Header values using Angular 5 and Express.js – Node.JS

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 [crayo...

Write Cloud Functions on Cloud Firestore and deploy – Introduction
databases , firestore , Node.js / May 16, 2019

Contents > What is Cloud Firestore >What are Cloud functions >Writing and Deploying Cloud Functions to write data to Cloud Firestore Collection What is Cloud Firestore It’s a NoSQL document database that lets you store data for your Mobile Application, web Application, APIs… It is Cloud-based, highly scalable and flexible. To see your Firestore database dashboard visit the below URL https://console.firebase.google.c...

Testing Node.js,Express.js API with Mocha and Chai – Typescript

Contents >What is Mocha >what is Chai >what is Chai HTTP >Installing dependencies and getting started >Writing tests in the test files What is Mocha Mocha is a Javascript testing framework working on both Node.js and in the browser. We can use mocha to test APIs written to run in Node.js, created using frameworks like Express. Mocha runs the test cases serially and provides very accurate reporting. Mocha makes testing as...

Redis Tutorial Part 4– Redis Data structures setting expiration time for key with Node.js ioredis
databases , linux , redis / April 24, 2019

Setting  expiration time for a data in Redis Consider an object which contains name and type. We store this data in Redis using the Redis hashes data structure. [crayon-5d85b4235a9bb185265592/] We store this data into a key called listdb using the following code [crayon-5d85b4235a9c1317693308/] hset is used to set a key and corresponding value in the hash.   Now we set the expiration time for  key listdb using expire [crayon-5...

Redis Tutorial Part 3 – Redis Data structures and working with Node.js ioredis

Redis Data structures Key-value stores mostly support string keys and string data but Redis does a lot more than that. Redis is not just a simple key-value string store It supports complex kinds of data structures, not just string. We will look more into this property of Redis in this tutorial and see how to utilize this using Node.js and ioredis module. Get the ioredis module installed on your app from https://www.npmjs.com/package/@ty...

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...