Posts

How to use git.

  Use git . Make account on github. after click on + for create repository  and name .  It' s only first time follow steps.  git config --global user.name "Type Your name" git config --global user.email "Type Your email" git touch .gitignore //touch for make file and if folder than use slash / git init git add .  // after add use (dot) git commit -m "Initial Commit " git status git remote add origin --Paste your ssh key or https key -- git push origin master  **Code after changes in file *** ** git status git add . git commit -m "add files" git push origin master  // Make branches .. git branch   //show branches  git branch login-system  //for create branches  git checkout login-system //  insert in branches. //after make login-branch. git status git add . git commit -m "code paste in login-branch" git push origin login-system  //for merge with master branch. git checkout master // insert in master branches git m...

Route Parameter and query string in express (Nodejs)

Route Parameter and query string in express (Nodejs).   import express from 'express' ; const app = express (); const port = process . env . PORT || '3000' // : it is use for showing dynamic values . app . get ( '/delete/student/:id' ,( req , res ) => {     console . log ( req . params );     res . send ( `Student Deleted ${ req . params . id } successfully.` ); }) app . get ( '/product/:category/:id' ,( req , res ) => {     console . log ( req . params );       res . send ( `Product Category is ${ req . params . category } and id is ${ req . params . id } ` );     // desturcture     // const {id , category } = req.params     // res.send(`Product Category is ${category} and id is a ${id}`); }); app . get ( '/product/mobile/:year/and/:month' ,( req , res ) => {     const { year , month } = req . params     res . send ( `Product Year is ${ year } and months is ${ month ...

Making router in express (Node js)

 Making router in express (Node js) 1. first file app.js import express from 'express' ; import stu from './routes/student.js' // const stu  = require('./routes/student.js'); //old pattern const app = express (); const port = process . env . PORT || '3000' //load Router Modules. app . use ( '/student' , stu ); app . listen ( port ,() => {     console . log ( "Server Connected Successfully." ); }); 2. student.js import express from 'express' ; const router = express . Router (); // All students routes.. router . get ( '/all' , ( req , res ) => {     res . send ( "All Students" ); }) router . post ( '/create' , ( req , res ) => {     res . send ( 'Create Studends.' ); }) router . put ( '/update' , ( req , res ) => {     res . send ( 'Update student' ); }) router . delete ( '/delete' ,( req , res ) => {     res / send ( 'Delete student'...

destructuring in javascript

destructuring in javascript  : The  destructuring assignment  syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables. Example :: first:: Object const myObjet = {     name: "Harry",     className: "first",     subject:"Hindi",     state:"Rajasthan",     pincode:300000, } const {name,className, subject,asd,pincode} = myObjet; console.log(name,asd,pincode); Output::Harry undefined 300000 Example::Second:: Object const myObjext = {     name:"Harry",     className: "five",     subject:"Hindi",     state:"rajasthan",     pincode:123123 } function showObject({name, className, subject,state,pincode}){     const message = "my name is "+name + " I am study in "+className +     " i like " + subject +" subject most. my state is  "+ state +" ok."     console.log(message...

Rest parameters in JavaScript

Rest parameters  The rest parameter syntax allows a function to accept an indefinite number of arguments as an array.  Only the last parameter in a function definition can be a rest parameter. function first(firtstar,...argments){     console.log(firtstar,argments); } first(1,3,3,4,5); Output::1 [ 3, 3, 4, 5 ]

CallBack function in javaScript.

 ðŸ‘Œ  CallBack function in javaScript.  function callback(){     console.log("This is a my first call"); } function test(name,call){     console.log("My name is "+ name);     call(); //same arguments name/ } test("anil",callback); //same name of callback function;

Routing in express (Node )

                                    ✔    Routing in express  (Node ) import express from 'express' ; const app = express (); const port = process . env . PORT || '3000' app . get ( '/' ,( req , res ) => {     res . send ( "Hello Friends " ); }); app . all ( '/sab' ,( req , res ) => {     res . send ( "Hello All  " ); }); app . all ( '/api/*' ,( req , res ) => {     res . send ( "Page Not found" ); }) //string pattern path. app . get ( '/ab?cd' ,( req , res ) => {     res . send ( 'it showing abcd and acd' );     //it's showing abcd and acd . }); //Regular expression // app.get(/a/,(req,res)=>{ //     res.send('woking when type a with any data'); //     //not write with single '' quote with /a/ // }); app . get ( '/oncecallback/' ,( req , res ) =...