Posts

Showing posts with the label Full Stack

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' )...

NodeJS Standard Way to Write Models with Sequelize

Image
As we all know in our node js project there is one main file which is generally index.js or app.js . so if we put all code related to models file load so that is not an standard way of coding so for solving this problem we can create model directory , inside this directory we can create one index.js file in which we load all the models then call in models/index.js file in our main file.  Node JS Here is our app.js file: "use strict" require ( 'dotenv' ). config (); //for calling process.env.VAR_NAME globally const server = require ( './config/server' ), express = require ( 'express' ), app = express (), port = server . port ; require ( './src/models' ); // all routing app . get ( '/' , ( req , res ) => { res . send ( server . appName ) }) app . use ( '/api' , require ( './src/routes/index' )); //listen server on mentioned port app . listen ( port , "0.0.0.0" , () => { console . log ( ` ...

How To Check MongoDB ID Valid Or Not

Image
As you must aware about the object ID in mongo database or MongoDB is 24 characters long so for check is it valid id or not there is no direct validation method in validations package such as node-input-validator. MongoDB - Education Funda So for checking entered id is valid or not we can us below tech-tics: Approach 1 - Simple JS Validation var checkForHexRegExp = new RegExp("^[0-9a-fA-F]{24}$") checkForHexRegExp.test("i am a string") // false checkForHexRegExp.test("5e63c3a5e4232e4cd0074ac2") // true Approach 2 - With Mongo DB Method (Best Way) var ObjectID = require("mongodb").ObjectID ObjectID.isValid("i am a string") // false ObjectID.isValid("5e63c3a5e4232e4cd0274332") // true With Node Input Validator You Can Use Below Method: const id_exists = "required|string|minLength:24|maxLength:24|idExists"   const validator = require ( "node-input-validator" ) const mongoose = require ( 'mongoose...

Standard Way To Create Node 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 NodeJS in standard way. NodeJS - Education Funda Requirements Any server should be installed either Apache or Nginx. NodeJS and NPM should be installed in the operating system.  Steps to Install Fresh Node JS Project: First open your terminal and go to your project directory then run following commands ~ npm init (after hitting this command it will ask some basic questions you can answer it as per your need.   ~ npm init ~ npm install express (it will install express server for your project) ~ npm install mongodb (optional - if you want to use mongo) ~ npm install mongoose (optional - if you want to use mongo) ~ npm install nodemon --save-dev (nodemon package is using for automatically refresh after any change and we're using save dev here because we want to install it for development purpose only) To do setup of licens...

Database Seeding in NodeJS with MongoDB

Image
Seeders in NodeJS Database seeding is a process in which we can put predefined data or dummy data in database as per need. such as the data of countries, cities, etc. is fixed data for everyone for these kind of data we can create database seeding files and we can put all the data into database with the help of 1 command only. Step 1 : We should have model firstly for which we want to create seeding so here is an example model Product. productModel.js Step 2 : As we want to run 'database seeders' separately in one command so have can create one file for seeders and in this file we also need to add database connection so that we can communicate with database because here app.js/index.js database connection doesn't work as we want to run this separately so example seeder.js file is: Seeders.js   Step 3 : Now we can run command node seeders.js to create seeding in database Thanks for reading this article I hope it will help you for creating seeders in node js with mongo datab...

Top 15 JavaScript Interview Questions

Image
Most Commonly Asked JavaScript Interview Questions JavaScript is the most popular scripting language and it was developed by Netscape and used to develop the client-side web applications. JS - Education Funda The real name of JavaScript was Mocha . JavaScript is provided by Netscape and JScript name is provided by Microsoft. Check The 15 JavaScript Interview Questions in Below Video: © Education Funda Some Important Features of JavaScript Are: Lightweight Easy to use with html Compatible with most of the programming languages Open source platform for everyone Thanks for reading this article ✌

Understand Agile Methodologies

Image
Agile & It’s Methodologies (Scrum, XP, Crystal, FDD, DSDM, LSD, Kanban) Agile Concept - Education Funda Agile is a software development approach which has multiple methodologies which we have to follow in it. Agile follows the iterations process, which means delivery project modules milestone wise. SCRUM is part of Agile or one of the Agile methodology. SCRUM methodology works under team-centric flow, meaning all team work in team.  SCRUM basically follows the 3 step rules which is Product Owner, Scrum Master and The Team. Product Owner is that person who directly deals with clients and which is like a principle of that project. Scrum Master is like a Team Lead for that project who assigns everything to the team and does further management. The Team includes all the back-end developers, designers, etc which is the team of 3 - 9 persons maximum as per SCRUM rule. XP (extreme programming) works under customer-centric flow, which means this methodology focuses on customer feedback...

Top MongoDB Interview Questions

Image
MongoDB is a document database with the scalability and flexibility that you want with the querying and indexing that you need. Education Funda Let's Jump Into Directly Top 10 MongoDB Interview Questions: Important Notes BSON vs JSON JSON is Standard File Format whereas BSON is Binary File Format. BSON is faster then JSON because it is more efficient and MongoDB stores data in BSON format via MongoDB drivers data converted when we save or update any data. JSON takes less storage space whereas BSON takes more space as compared between both. We can embed 100 JSON formats inside JSON maximum. BSON is an encoded format of data so not easily readable for humans whereas JSON we can easily read. Objectld is composed of: Timestamp Client machine ID Client process ID 3 byte increment counter UpdateOne() vs ReplaceOne() With replaceOne () you can only replace the entire document, while updateOne () allows for updating fields.   Since replaceOne () replaces the entire document - fields in th...

Node Js Interview Questions

Image
Node.js  is an open source, cross-platform runtime environment for developing server-side and networking applications.  It uses single threaded event loop architecture to handle multiple concurrent clients at same time. The processing model is based on the JS event and callback mechanism. We can do asynchronous tasks easily with this programming language. What is NPM in Node.js ? NPM (Node Package Manager) helps to install all the dependencies of the project from the package.json file.it holds all the metadata about a particular project. We can add or update any package/library very easily with the help of commands only. Let's check the "most commonly asked node js interview questions" in below video: Thanks for reading this blog, I hope this node js interview questions blog will help you to crack node js interview easily.

Full Stack Development

Image
FULL STACK DEVELOPMENT  A Full Stack Web Developer is someone who is able to work on the front-end and the back-end portions on an application. Being a Full Stack Developer doesn't mean that you have necessarily mastered everything required to work with the front-end, But it means that you are able to work on both sides and understands what is going on when building an applications. More About Full Stack Development Guys, for become a full stack developer you should have knowledge of following languages: html & css java-script all back-end languages database and web storage HTTP and rest API   Venn Diagram As in this "Venn Diagram" you can see that "Full Stack Development" is actually a combination of Front-End, Back-End & Database. So, if you have knowledge of all languages than you can become a "Full Stack Developer", I know while reading this 'article' you think this is 'impossible' but don'...

Mean Stack Development

Image
MEAN STACK DEVELOPMENT  M E A N Stands For: Mongo DB Express JS Angular JS Node JS MEAN is a collection of JavaScript-based technologies such as: Mongo DB, Express.js, AngularJS, and Node.js — used to develop web applications. From the client and server sides to databases. MEAN is a Full-Stack development toolkit. More About Mean Stack Development Work Process Diagram As in the above diagram clearly shown how these technologies works together for develop an Web Application. Angular JS being client makes AJAX calls to Express JS then it response in JSON format. Express JS that is running on Node JS server further communicate with Mongo DB(No SQL Database) as persistent medium.  I hope below video will also help you for more Thank You For Reading This Article