Angular - Using inbuilt directives

import { Component, OnInit } from '@angular/core';


@Component({
  selector: 'app-built-in-directives-demo',
  templateUrl: './built-in-directives-demo.component.html',
  styleUrls: ['./built-in-directives-demo.component.css']
})
export class BuiltInDirectivesDemoComponent implements OnInit {

  items= ['A', 'B', 'C', 'D'];
  timeOfDay= 'morning';
  constructor() { }

  ngOnInit() {
  }

}

Template using Directives

Tags

Stoplight Prism - Creating Docker image with API specification embeded inside

Prism is very lightweight and easy to use API mocking server which reads API specification and creates mock API endpoints for the developer. It can create dynamic values for fields and can validate request data against the specification.

Another feature is creating a proxy server that will help you debug API call from client to API server. In this mode, prism intercepts incoming requests and outgoing responses so you can validate the work done by the backend developer.

Tags

NodeJS - Creating Module

Many times we uses modules in nodejs applications which comes from different package added in package.json file. This allows us to organize the code and to create reusable components.

Here are simple steps to create your own custom module.

Create a module file mymodule.js

exports.myServerTime = function () {
  return "Today is "+Date();
};

In the above code, you would notice a keyword "exports" which make properties and menthods of this module outside of this module file.

ReactJS - Adding reactjs in existing website

1 Create ReactJS app

Create any react app as usual you do. There is nothing special you need to configure to use the react app code in existing website.

2 Add the .env file at the root of this application

This file would contain some configuration values that will be used by build tool.

3 Add the INLINE_RUNTIME_CHUNK=false in .env file

This configuration would allow to create separate packaged code of entire react app at one place.

Tags

JavaScript - How does Inheritance work in Javascript

In JavaScript, you can use Object Oriented Design concept and one of them is inheritance. In JavaScript, you can create child object from parent object and can override some properties if you want. Here is the example.

We have course Object which has properties name, duration and location with their respective values.

course = {name:'CKD', duration:'3 months', location:'india'}

Now, below we are creating another object with course object but would override duration property.

Tags

Kubernetes - Deployment Controller and why we create deployments

Sometime you must have heard about the application where multiple servers are running and an application is replicated on all servers to share the load of incoming requests. Its called load balancing by deploying multiple replicas of same application on all servers. 

Now, how would you do this in Kubernetes?

In Kubernetes , you no need to even ask to server team to setup this kind of deployment setup and it is too easy to do it. You just need to add few lines in your Kubernetes  configuration files. 

So, how Kubernetes  handling it?

Tags