Posts

Password Encryption in Express using bcryptjs module , Password Decryption in Express using bcryptjs module. Login API using Express with password encryption . Example . Testing with postman

  Password Encryption in Express using bcryptjs module , Password Decryption in Express using bcryptjs module. Login API using Express with password encryption . Example . Testing with postman package.json { "name": "login3app", "version": "1.0.0", "description": "", "main": "server.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "dev": "nodemon server.js" }, "author": "s.kundu", "license": "ISC", "dependencies": { "bcryptjs": "^2.4.3", "express": "^4.19.2", "mongoose": "^8.5.3", "nodemon": "^3.1.4" } } server.js const express = require('express'); const authroute=require('./routes/authroute'); const app=express(); const port

Routing concept in Express , Controller Concept in Express , Get() , Post() routing in express , Testing in postman. Mongoose (ODM) install , Connectivity with Mongodb using mongoose.Connect() . Examples

Routing concept in Express , Controller Concept in Express , Get() , Post() routing in express , Testing in postman. Mongoose (ODM) install , Connectivity with Mongodb using mongoose.Connect() . Examples   1. Routing Concept in Express    - Routing refers to how an application responds to client requests for a specific endpoint (URL) with a specific HTTP method (GET, POST, etc.).    - Basic Routing Example:      ```javascript      const express = require('express');      const app = express();            // GET route      app.get('/home', (req, res) => {        res.send('Welcome to the Home Page!');      });      // POST route      app.post('/submit', (req, res) => {        res.send('Form Submitted!');      });      const port = 3000;      app.listen(port, () => {        console.log(`Server is running on http://localhost:${port}`);      });      ```    - In the example above, when the user visits `/home` with a GET request, they'll s

Express Install , MVC architecture concept , Nodemon install , express server configuration , Postman Install , basic get() , post() operations in api and testing using postman.

 Express Install , MVC architecture concept , Nodemon install , express server configuration , Postman Install , basic get() , post() operations in api and testing using postman. Here's a basic guide to get you started on your first day with Express:  1. Express Installation    - Step 1: Make sure Node.js is installed on your system. You can check this by running:      ```bash      node -v      npm -v      ```    - Step 2: Initialize a new Node.js project by running:      ```bash      npm init -y      ```    - Step 3: Install Express using npm:      ```bash      npm install express --save      ```  2. MVC Architecture Concept    - Model: Handles the data logic (e.g., database interaction).    - View: Manages the display of data (e.g., HTML, templates).    - Controller: Handles the business logic, processes requests, and returns responses.    - Express is often used with MVC to separate concerns, making the code more organized and maintainable.  3. Nodemon Installation    - Nodemon

Mongodb restore and Run MongoDB with Laravel

 Run after below settings: mongorestore -d wbtourism_live dump/homestore database files store: store the file database list of json into,  C:\Program Files\MongoDB\Server\6.0\bin\dump\homestore where homestore is the my local exported data for mongodb: test> use wbtourism_live switched to db wbtourism_live wbtourism_live> show tables extension=php_ftp.dll extension=php_mongodb.dll php_mongodb.dll file paste in php/ext inside xampp file. MongoDB Command Line Database Tools Download for restore and other command line tools. for .env DB_CONNECTION=mongodb DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=wbtourism_live DB_USERNAME= DB_PASSWORD= MONGO_DB_HOST=127.0.0.1 #local MONGO_DB_PORT=27017 MONGO_DB_DATABASE=wbtourism_live MONGO_DB_USERNAME= MONGO_DB_PASSWORD=

Express Js Basics

 Express.js is a minimal and flexible web application framework for Node.js that provides a robust set of features for building web and mobile applications. It simplifies the process of handling HTTP requests, building APIs, and managing middleware. Node.js is a cross-platform, open-source JavaScript runtime environment that can run on Windows, Linux, Unix, macOS, and more.   Key Features of Express.js: 1. Routing:    - Express provides a powerful and intuitive way to define routes for your application. You can easily create routes to handle different HTTP methods (GET, POST, PUT, DELETE, etc.) and define route parameters. 2. Middleware:    - Middleware functions in Express.js are functions that have access to the request object (`req`), the response object (`res`), and the next middleware function in the application’s request-response cycle. They can perform tasks like logging, authentication, parsing JSON, handling errors, and more. 3. HTTP Methods:    - Express allows you to handle

Express Js Basic Installations

 Here’s a guide for Day 1 of your Node.js learning journey, covering the installation and basics of Express, setting up an MVC architecture, installing and configuring Nodemon, and using Postman for testing basic `GET` and `POST` operations.  1. Install Node.js Before starting, ensure you have Node.js installed on your machine. If not, download and install it from [Node.js official website](https://nodejs.org/). ---  2. Express Installation 1. Create a new project directory:    mkdir my-express-app    cd my-express-app 2. Initialize a new Node.js project:    npm init -y 3. Install Express:    npm install express ---  3. MVC Architecture Concept MVC stands for Model-View-Controller. It’s a design pattern used to separate the concerns of your application: - Model: Manages the data and business logic. - View: Handles what the user sees (UI). - Controller: Receives input from the user and makes calls to Model and View to perform appropriate actions. Express MVC Setup: - Models: Will contai

MONGODB OPERATORS

MONGODB OPERATORS Comparison Operator $eq $ne $gt $gte $in $lt $lte $nin Logical Operator $and $or $not $nor Element Operator $exists $all $elemMatch $size Evaluation Operator $expr $mod $elemMatch $slice $text:$search Set Top-Level Field Operator $min $max $mul $round $multiply $mul $rename updateOne() updateMany() limit() skip() sort() find() runCommand() createCommand() deleteOne() deleteMany() drop() insertOne() insertMany() aggregate([]) With runCommand distinct count Aggregation Pipeline Operators $abs $add $subtract $multiply $divide $ceil $floor $mod $pow $round $sqrt $trunc $arrayElemAt $arrayToObject $concatArrays $in $indexOfArray $range $reverseArray $size $slice MongoDB Query and Projection Operator The MongoDB query operator includes comparison, logical, element, evaluation, Geospatial, array, bitwise, and comment operators. MongoDB Comparison Operators $eq The $eq specifies the equality condition. It matches documents where the value of a field equals the specified val