Higher Quality Code should have

Jan 4, 2023

Comply business logic. Short. Understandable. Break down into function/components. Have common utility. Reusable. Documented. Good to have unit tests. Reformatted. ES-Lint should be enabled. File size should not be more than 500 lines. Using sonarlint, can easily maintain and remove cognitive complexity of functions and unused items. We should also focus on optimization of code, […]

Click Here

s3 cloudfront restriction permissions

Jan 23, 2022

{ “Version”: “2008-10-17”, “Id”: “PolicyForCloudFrontPrivateContent”, “Statement”: [ { “Sid”: “1”, “Effect”: “Allow”, “Principal”: { “AWS”: “arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity <cloudfront Identity>” }, “Action”: “s3:GetObject”, “Resource”: “arn:aws:s3:::<bucket>/*” } ] }

Click Here

s3 presigned test

Jan 23, 2022

const AWS = require(‘aws-sdk’); const fs = require(‘fs’); const path = require(‘path’); const axios = require(‘axios’); //configuring the AWS environment AWS.config.update({ accessKeyId: “<key>”, secretAccessKey: “<key>” }); var s3 = new AWS.S3(); var filePath = “file.txt”; //configuring parameters var params = { Bucket: ‘<bucket>’, Body : fs.createReadStream(filePath), Key : Date.now()+”_”+path.basename(filePath), ContentType: ‘application/octet-stream’ }; s3.getSignedUrl(‘putObject’, params, function […]

Click Here

ses test

Jan 19, 2022

const AWS = require(‘aws-sdk’); // Amazon SES configuration const SESConfig = { accessKeyId: ‘‘, secretAccessKey: ‘‘, region: ‘us-east-1’ }; var params = { Source: ‘admin@rware.com’, Destination: { ToAddresses: [ ‘anurag@techvalens.com’ ] }, ReplyToAddresses: [ ‘admin@rware.com’, ], Message: { Body: { Html: { Charset: “UTF-8”, Data: ‘test’ } }, Subject: { Charset: ‘UTF-8’, Data: ‘test’ } […]

Click Here

s3 test

Jan 19, 2022

Creating a Node JS project an example file for upload ——————- npm init npm install aws-sdk –save Now, create a “index.js” file in the root folder and put the following content const AWS = require(‘aws-sdk’); const fs = require(‘fs’); const path = require(‘path’); //configuring the AWS environment AWS.config.update({ accessKeyId: ““, secretAccessKey: “” }); var s3 […]

Click Here

JavaScript Array Methods

Apr 2, 2021

If you’re a JavaScript developer and want to improve your coding, then you should be familiar with the most commonly used ES5 and ES6+ array methods. These methods make coding a lot easier and also make your code look clean and easy to understand. So in this article, we will explore some of the most […]

Click Here

Git – 50 Git Commands

Apr 2, 2021

Git is a distributed version control system that helps developers collaborate on projects of any scale. Linus Torvalds, the developer of the Linux kernel, created Git in 2005 to help control the Linux kernel’s development. What is a Distributed Version Control System? A distributed version control system is a system that helps you keep track […]

Click Here