Posts

Deploy Angular Build With Express JS Project

Image
Deploy Angular Build in Node JS (Express JS) Server Mean Stack - Education Funda Firstly Create Angular Production Ready Build: ~ ng build (run in command line when directory is projectFolder). ~ Compress using Brotli compression the resources using the following command for i in dist/*/*; do brotli $i; done Deployment Check Angular Build: You can get a preview of your application using the ng serve --prod command that starts a local HTTP server such that the application with production files is accessible using http://localhost:4200. This is not safe to use for production usage. For a production usage, you have to deploy all the files from the dist folder in the HTTP server of your choice. Node JS/Express JS Server File Changes: //enabling CORS app . use ( cors ()); app . use ( express . static ( path . resolve ( './public' ))); //api v1 base route set app . use ( '/api/v1' , router ); //angular front site app . use ( express . static ( path . resolve ( './public/a...

Install Free SSL For Nginx Server with Ubuntu 20.X

Image
If you want to install free SSL for your domain then you are on right blog. In this blog I will explain you how you can configure free SSL certificate with Ubuntu Server. By Education Funda Step 1: Go and connect to your server with ROOT user either with SSH or Putty. Step 2: Now enter this command $ sudo apt-get update Step 3: Now enter this command $  sudo snap install core; sudo snap refresh core Step 4: Now enter this command $  sudo apt-get remove certbot Step 5: Now enter this command $  sudo snap install --classic certbot Step 6: Now enter this command $  sudo ln -s /snap/bin/certbot /usr/bin/certbot Step 7: Now enter this command $  sudo certbot --nginx Now in Step 7 after enter it will ask your domain name and email address please enter details carefully here then That's it, You have done it, Yeah 💪 It will be valid up-to 3 months. For any question or feedback please write into comments section, I hope this blog will be helpful for you if Yes t...

JavaScript Logical Output Based Interview Questions

Image
You mostly seen in JavaScript interviews there interviewers must asks output based questions in which candidate stuck mostly so here in this blog I'm telling you most commonly asked output based JavaScript interview questions. By Education Funda Most Commonly Asked JavaScript Output Based Questions Question: 1 function sum(){      let a = 8;      const b=2;      var c=a+b; } console.log(a) // Reference error: a is not defined console.log(b) // Reference error: b is not defined console.log(c) // Reference error: c is not defined sum() console.log(a) // Reference error: a is not defined console.log(b) // Reference error: b is not defined console.log(c) //Output: undefined ---------------------------------------------------------------------------- Question: 2 let arr=[1,2,3,4,5]; console.log(arr[2], arr.length); //Output: 3 5 arr.length=0; console.log(arr[2], arr.length); //Output: undefined 0 Note:  As we can see in above code 1st ques...

Run Node JS Project Without Port in URL

Image
We can remove PORT from URL in Node JS project from server configuration files So we have mainly two types of server base: Nginx Apache For both we generally have /etc/nginx/default OR /etc/apache2/default file . So you have to edit it manually which you can do via below steps: 1. Firstly go into nginx/apache2 directory  Then, Run command: ~ sudo nano default configuration file will open in edited mode from which you can edit now server { listen 80 default_server; listen [::]:80 default_server; location { proxy_pass http://yourdomain.com:3000;      #try_files comment this line manually via adding # } } Restart your server via nginx/apache2 ~ sudo service nginx restart ~ sudo service apache2 restart That's it now check http://yourdomain.com this will also work same. Happy Coding !!

JavaScript Most Commonly Asked Data Structure Questions

Image
Let's See Some Of The Most Commonly Asked Data Structure Interview Questions with Answers Related To Arrays, String and Objects JS Data Structure - Education Funda 1. Custom sorting program in JS via Bubble Sort ? 2. Write a program to check if a string or word or number is palindrome ? Examples of Palindrome Words are:  racecar, madam. 3. Write a program to check if value/target exists or not in ascending array in O(log n) time complexity ? For doing this you should know the Binary Search Algorithm. 4. Write a program to get total vowel count from String ? 5. Write a program to prints factorial of any number ? 6. Write a program for check number is prime or not from 100 to 200 ? 7. Write a program to check whether number is perfect number or not ? Prime Number:  whose SUM of all factors equal to value expect value itself factor. 8. Write a program to find duplicate numbers in an integer array ? 9. How do you find all pairs of an integer array whose sum is equal to a...

Standard Way To Create React JS Fresh Project

Image
As you know in programming world  JavaScript  is becoming quite famous programming language so in this blog we will discuss how we can create fresh project of  ReactJS  in standard way. React JS - Education Funda ~ $ npx create-react-app folder-name ~ $ npx create-react-app folder-name --template typescript To do setup of license, .gitignore and code of conduct for new project we can do with NPX commands: ~ npx license mit (it will create open source license for your project) ~ npx gitignore node (it will create .gitignore file in your project automatically so you don't need to create it manually)  ~ npx covgen your_email_id (it will create code of conduct file for your project)

Merge Multiple PDF Buffers in Node JS

Image
Let's See How We Can Merge PDF Buffers in Node JS with "pdf-merger-js" PDF Merger JS - Education Funda For merging pdf buffers we should firstly have the buffers of each pdf and we can run loop than can add each buffer for create one single merge buffer. If You Have HTML Files Which You Want to Convert to PDF Buffer and Create 1 Single Merge PDF const getNoticesPreview = async (req, templateId ) => { const caseIdsArr = req. body . caseIds . split ( "," ); var merger = new mergePdfs (); for ( let i = 0 ; i < caseIdsArr. length ; i ++ ) { let caseId = caseIdsArr[i]; let caseDetails = await caseService. getCase (caseId); let templateDetails = await templateService. getTemplate ( templateId ); let options = { format : 'A4' }; let compiled = ejs. compile (fs. readFileSync ( __dirname + 'public' + templateDetails. templateFile , 'utf8' )...