Posts

Showing posts from March, 2024

git common command

  git init git add README.md git commit -m "first commit" git branch -M main git remote add origin https://github.com/VidalGaurav/healthlogs.git git push -u origin main https://www.npmjs.com/package/react-scrollable-picker https://canvasjs.com/react-charts/bar-chart/ https://javascript.plainenglish.io/top-10-reactjs-coding-interview-challenge-for-2024-c1e591f9384c https://stackoverflow.com/questions/60134596/create-react-app-without-typescript-got-error-failed-to-load-parser-types https://stackoverflow.com/questions/71700127/how-to-properly-encrypt-and-decrypt-passwords-using-react-mongodb-and-express

middleware node[model]

Image
 express.json():-json object to javascript  object/parser [body-parser node js] post request:-- validator: error handler Understanding Hooks in Mongoose: A Guide to Middleware | by Uzair Ahmed | Medium https://owasp.org/www-community/attacks/csrf https://www.geeksforgeeks.org/express-cookie-parser-signed-and-unsigned-cookies/ https://owasp.org/www-community/attacks/csrf hh

api

 https://codesandbox.io/p/sandbox/reverent-moon-ms5kwz?file=%2Fsrc%2FApp.js%3A3%2C1-4%2C46

Drawer

  import * as React from " react " ; import Box from " @mui/material/Box " ; import Drawer from " @mui/material/Drawer " ; import Button from " @mui/material/Button " ; import List from " @mui/material/List " ; import Divider from " @mui/material/Divider " ; import ListItem from " @mui/material/ListItem " ; import ListItemButton from " @mui/material/ListItemButton " ; import ListItemIcon from " @mui/material/ListItemIcon " ; import ListItemText from " @mui/material/ListItemText " ; export default function AnchorTemporaryDrawer () {   const [ state , setState ] = React . useState ({     top : false ,   }) ;   const toggleDrawer = ( anchor , open ) => ( event ) => {     if (       event . type === " keydown " &&       ( event . key === " Tab " || event . key === " Shift " )     ) {       ...

sessionandcookienodejs

 mongoose.model(collectionname,scema); session:-- express-session install let session=require("express-session"); app.use(session({ resave:false,//if the session value doesnt save then does'nt save again saveUninitialized:false,//if the client doesnt have give the uninilized data then doesnt save secret:"key1"//secret key }); router.get("/",function(req,res){ req.session.key1='hello';//value[true] res.render("index");//index ejs page.. }) //u can access that session in other routes:--- router.get("/",function(req,res){ req.session.key1='hello';//value[true] res.render("index");//index ejs page.. }) router.get("/check",function(req,res){ console.log(req.session.key1); //or u can check:-- if(req.session.key1){ } else{   } } router.get("/check",function(req,res){ req.session.destroy(function(err){ if (err) throw err; res.send('session removed"); } cookie:-- npm i cookieParser[expre...

mongodbschema node js

Image
 

pagination api called react side using material ui

  import React ,{ useState } from 'react' import { FiArrowLeft } from "react-icons/fi" ; import { useNavigate } from "react-router-dom" ; import Providercss from './Style/ProviderList.module.css' ; import mapicon from '../assets/map-pin.png' ; import discounticon from '../assets/DiscountStar.png' ; // import { Button} from 'react-bootstrap'; import Button from '@mui/material/Button' ; import { ToastContainer , toast } from 'react-toastify' ; import Variables from '../global.ts' // import { Spinner } from 'react-bootstrap'; import CircularProgress from '@mui/material/CircularProgress' ; import Box from '@mui/material/Box' ; import Pagination from '@mui/material/Pagination' ; export default function ProviderList () {   const navigate = useNavigate ();     const [ pin , setPin ] = useState ( '' );   const [ loading , setLoa...

learntopic

 node:--- jwt token:--Passport login:-------token....client..........next time login....token verified.....or then only he is allowed to move with other routes pagination:-- we have to do in backend that api we have to from frontend[bootstrap,material ui] bcrypt:-- create account:--- save the password in encrypted format login....checked that from that encrypted backend...aes256[modules..bcrypt] created form:-- file upload:-- input type:file backend:--multer express js:-- schema:--[validation] username userpass

ejs node js template engine

 ejs:-template engine error handling ............................. ejs:---- install ejs set view engine create views  folder create ejs files render ejs files inside route express static files setup architecture of public folder ..................................... express generator:----[time saving] folder strutcure already setup npm i express-generator -g[global install] to create new app:- open cmd move to folder create new app:- express appname --views=ejs now cd appname npm i open in vs code... //cd onedrive cd desktop npx nodemon to run .......................................................................