Skip to main content

Posts

Showing posts from February, 2023

Node & Redis cache Connection

Refer below link to connect both and follow below details for docker integration:   node.js - Nodejs Redis createClient() function - Stack Overflow Install the Redis package: First, you need to install the Redis package for Node.js. You can do this using npm by running the command npm install redis. Initialize Redis client: In your server-side code, you would create a Redis client instance using the redis.createClient() method, which establishes a connection to the Redis server. You can also pass in configuration options such as the Redis server host and port. Add caching logic: Once you have a Redis client instance, you can add caching logic to your server-side code. This typically involves wrapping a function that retrieves data from a database or external API in a Redis cache check. For example, you might use the Redis get() method to check if the requested data already exists in the cache. If it does, you can return the cached data. If it doesn't, you would fetch the data fr...

React Redux

Some common keywords associated with React Redux are: Store : A global state object that holds all the data for the application. Actions : A plain JavaScript object that describes what you want to do. Action creators : A function that creates an action. Reducer : A function that updates the state of the application in response to an action. Dispatch : A method that dispatches an action to the store. Provider : A component that makes the store available to the rest of the application. Connect : A higher-order component that connects a component to the store. mapStateToProps : A function that maps the state of the store to the props of a component. mapDispatchToProps : A function that maps dispatch actions to the props of a component. Middleware : A function that enhances the behavior of the store and can be used for logging, debugging, or handling asynchronous actions.

Pros & Cons of going to the office

Just random thoughts after working from home and from office...hmm 🤔   Pros of going to the office: Collaboration : Going to the office provides an opportunity for in-person collaboration with coworkers. This can lead to better teamwork and more productive discussions. Work-Life Balance : For some people, a clear separation between work and personal life is important for maintaining a healthy work-life balance. Going to the office can provide that separation and help individuals focus on work when they are at work and relax when they are at home. Social Interaction : Going to the office can provide opportunities for social interaction with coworkers and can foster a sense of community and belonging. Professional Development : Going to the office can provide opportunities for professional development and learning through in-person training and other activities. Cons of going to the office: Commuting : Commuting to and from the office can be time-consuming and stressful and can...

JEST for React and Angular | React and Angular Testing Library | MS App Dynamics

 import { Component, Input } from '@angular/core'; @Component({   selector: 'app-hello',   template: `<h1>Hello {{name}}!</h1>`, }) export class HelloComponent {   @Input() name: string; } // The test for the component import { HelloComponent } from './hello.component'; import { TestBed } from '@angular/core/testing'; describe('HelloComponent', () => {   beforeEach(() => {     TestBed.configureTestingModule({       declarations: [HelloComponent],     });   });   it('should display the name', () => {     const fixture = TestBed.createComponent(HelloComponent);     const component = fixture.componentInstance;     component.name = 'Jest';     fixture.detectChanges();     const h1 = fixture.nativeElement.querySelector('h1');     expect(h1.textContent).toBe('Hello Jest!');   }); }); --------------------------------------------------------...