December 8, 2022

Steps to set up new AWS EC2 instace to deploy NodeJs application

 



Follow below steps to set up new NodeJs application on AWS EC2 instance:

1. AWS - Create new instace (Download .pem file)

2. Connect EC2 install using .pem file (sudo ssh -i <.pem file full path> ubuntu@<instace Public IPv4 address>)

2. Install nginx (sudo apt install nginx)

3. Install NodeJs (sudo apt install nodejs)

4. Install NPM (sudo apt install npm)

5. Install postgreSQL (sudo apt install postgresql postgresql-contrib)

6. Allow port(5432) for postgreSQL: Goto > instace > Security > Security Groups > Edit inbound rules > Add rule

6. Install git (sudo apt-get install git)

7. Install pm2 to run Node application (https://www.npmjs.com/package/pm2)

8. Now server ready to used you need to get git clone of your project repository.


Enjoy!

December 7, 2022

Steps to update or change NodeJS and NPM versions.


 


1. First let's try to change NPM package version.

- Check current NPM version: npm view npm version

- Using this command you can update npm to latest version: npm i -g npm


2. For Node version best way to manage version use NVM.

- nvm install <Node version> 

- nvm list

- nvm use <Node version>


3. To update NPM:

- npm install -g npm


Enjoy!

November 16, 2022

Steps to point GoDaddy Domain to AWS Route 53.



 

This post guide you to point any GoDaddy Domain to AWS Route 53 service. It's very easy process. Please follow steps. it's help you to host GoDaddy domain with AWS Route 53.


- First of fall sign in to AWS Console

- Go to Route 53 service on AWS

- From left side menu go to Hosted Zone and create new Hosted Zone

- Insert domain and select public hosted zone option

- Save name server form

- Now hosted zone created and it's generate NS(name server) and Route trafic to DNS name

- Now sing in to Godaddy account and go to product manager

- Click on DNS option for the domain you want to point and go to DNS settings

- Add new DNS record, there are four fileds type, name, value and TTL

- Type: Select 'NS'

- Name: type '@'

- Value: Copy from created hosted zone one by one to insert all

- TTL: Select 1 Hour



Note: After this process complete all are good but it's take some time to point DNS.

Enjoy!

November 15, 2022

Steps for Beginners in NodeJs


 


If you are start to learn NodeJs then you have learn basic points. First you must understand the different between NodeJs and server side scripting languages like PHP, Paython and Ruby.


- Environment setup

- First 'hello world' application

- NPM package manager

- File system

- Web module

- Web controller

- Debugging

- Database connection


We will learn all in details on upcoming tutorial.


Enjoy!

May 26, 2022

How to securing access to of Swagger with HTTP Basic Auth? With example if TypeScript NestJS.



- First set up NestJS TypeScrip basic project.

- Install express-basic-auth module using this command: npm i express-basic-auth

- import module on main.ts file

- Full example of main.ts file:


// import auth module

import * as basicAuth from 'express-basic-auth';

// Add HTTP Basic Auth

app.use(

    basicAuth({

        challenge: true,

        users: {

            defineUserName: 'passwrd here',

        },

    }),

);


// Main Code

const options = new DocumentBuilder()

    .setTitle('First App')

    .setSchemes('https')

    .setDescription('Firsy App API documentation')

    .setVersion('1.0')

    .build()


const document = SwaggerModule.createDocument(app, options)

SwaggerModule.setup('docs', app, document, {

    customSiteTitle: 'First App documentation',

});


Enjoy! 

January 31, 2022

React 18 beta version available

 



React 18 is now in beta version. To know more about the release click here.

The main features of release are:

  1. We've started work on the React 18 release, which will be our next major version.
  2. We've created a Working Group to prepare the community for gradual adoption of new features in React 18.
  3. We've published a React 18 Alpha so that library authors can try it and provide feedback.

What new in React 18?

When it is new released, React 18 will include improvements like automatic batching, new API, and new streaming server renderer.


Enjoy!

Integrating Google reCAPTCHA v3 in HTML Form with PHP

  What is Google reCAPTCHA v3? Google reCAPTCHA is a free service that helps protect websites from spam and abuse. reCAPTCHA v3 is the lates...