Skip to main content

Posts

Persitence

 1)How to resolve dependecy in angular nodejs 2)How to call lambdas within and without system 3)How to run a file from s3 exe and run it 4)how to optimize nodejs 5) memory leak in nodejs

Nodejs Fork spawn material

 https://stackoverflow.com/questions/17861362/node-js-child-process-difference-between-spawn-fork/17861879#17861879 Spawn is a command designed to run system commands. When you run spawn, you send it a system command that will be run on its own process, but does not execute any further code within your node process. You can add listeners for the process you have spawned, to allow your code interact with the spawned process, but no new V8 instance is created(unless of course your command is another Node command, but in this case you should use fork!) and only one copy of your node module is active on the processor. https://www.freecodecamp.org/news/node-js-child-processes-everything-you-need-to-know-e69498fe970a/ Session can be maintained using jwt Is recursion same as callback

NOdejs birbal

1)Module object in nodejs to provide encapsulation? In Node.js, encapsulation can be achieved using the module system provided by CommonJS. CommonJS is a module system for JavaScript that allows you to encapsulate code into separate modules with their own scope, thereby preventing pollution of the global namespace and providing a way to organize and structure your code. Here's a basic example of how you can use CommonJS modules for encapsulation in Node.js: Create a module file (myModule.js): // myModule.js let privateVariable = 'I am private'; function privateFunction() {     console.log('This is a private function'); } module.exports = {     publicVariable: 'I am public',     publicFunction: function() {         console.log('This is a public function');         privateFunction(); // Private function can be accessed within the module     } }; 2)How to handle concurrent request in sockets? In Node.js, handli...

DynamoDb part 1

1)Create a table : const createTableParams = {   TableName: 'Orders',   KeySchema: [     { AttributeName: 'orderId', KeyType: 'HASH' }, // Partition key     { AttributeName: 'orderTimestamp', KeyType: 'RANGE' } // Sort key   ],   AttributeDefinitions: [     { AttributeName: 'orderId', AttributeType: 'S' },     { AttributeName: 'orderTimestamp', AttributeType: 'S' },     { AttributeName: 'customerId', AttributeType: 'S' }, // Attribute for GSI     { AttributeName: 'status', AttributeType: 'S' } // Attribute for GSI   ],   ProvisionedThroughput: {     ReadCapacityUnits: 5,     WriteCapacityUnits: 5   },   GlobalSecondaryIndexes: [     {       IndexName: 'CustomerIdIndex',       KeySchema: [         { AttributeName: 'customerId', KeyType: 'HASH' },         { AttributeName: 'orderTimestamp', Ke...

SQL part1

 1)To get all items from the table: SELECT * FROM tablename; 2)To get specific fields from the table: SELECT CustomerName, City FROM Customers; 3)Select distinct values for a column from a table: SELECT DISTINCT Country FROM Customers; 4)Get the count of distinct values for  a column from a table: SELECT COUNT(DISTINCT Country) FROM Customers; 5)Where conditions to get data from the table: SELECT * FROM Customers WHERE Country='Mexico'; 6)Where with and and or ,not : SELECT * FROM Customers WHERE Country='Germany' AND City='Berlin'; SELECT * FROM Customers WHERE City='Berlin' OR City='München'; SELECT * FROM Customers WHERE NOT Country='Germany'; 7)Sorting by default ascending SELECT * FROM Customers ORDER BY Country; SELECT * FROM Customers ORDER BY Country DESC; SELECT * FROM Customers ORDER BY Country ASC, CustomerName DESC; 8)Insert INSERT INTO Customers (CustomerName, ContactName, Address, City, PostalCode, Country) VALUES ('Card...

Latest interview

 1)Set vs Map A Set is a collection dataset that needs to be composed of unique values, where a Map is when you have pairs of associated data when we map the keys to the value.13-Dec-2020 https://osgoodgunawan.medium.com/map-vs-set-vs-object-in-javascript-7345b455afcd#:~:text=The%20difference%20between%20Map%20and%20Set,the%20keys%20to%20the%20value. 2)Versioning in API 4)Role base access 5)https status code for 111,333 series 1xx informational response  – the request was received, continuing process 2xx successful  – the request was successfully received, understood, and accepted 3xx redirection  – further action needs to be taken in order to complete the request This and all future requests should be directed to the given  URI . s 4xx client error  – the request contains bad syntax or cannot be fulfilled 5xx server error  – the server failed to fulfil an apparently valid request 6)Types of execution context global vs local 7)sequilze and kex librarie...