knowledge to learn nodejs HTML JAVASCRIPT(ADVANCE knowledge) ES6 DATABASE (MONGODB) MERN MONGODB EXPRESSJS REACTJS nodejs nodejs: IS an open-source,cross-platfrom JAVASCRIPT runtiime enviroment that allow you to run JAVASCRIPT code outside a web browser client side Script server side Script HTML php,asp.net,python,Go,nodejs css JAVASCRIPT USEAGE nodejs (RYAN DAHL MAY 2009) CREATE WEB APPS CREATE APIS USE TECHNOLOGY CHROME V8 JAVASCRIPT ENGINE WHICH IS FASTER LIGHTWEIGHT EFFICIENT SCALABLE CMS FASTER ERP,CRM SOFTWARE MAIL server REAL-TIME APPLICATION :CHATING SYTEM ,ONLINE GANMES FILE STORAGE SYSTEM COMMAND-LINE TOOLS BACKEND FOR MOBILE APPS STREAMING dATA :VIDEO STREAMING,AUDIO STREAMING,AND PROCESSING SENSOR DATA FROM LOT DEVICE @@@@ nodejs BENEFITS @@@@ PERFOMANCE V8 ENGINE AND NON-BLOCKING I/O MAKE IT VERY FAST AND EFFICIENT SCALABILITY :EASY HANDLE A LARGE NUMBER OF CONCURRENT CONNECTION FULL-STACK JAVASCRIPT :DEVELOPR CAN USE JAVASCRIPT FOR BOTH LARGE ECOSYTEM:NPM provide a vast collectionof libraires and TOOLS community: a large and active community provider support real time capabilities: excellent jfor buliding real time APPLICATION popular websites netflix,linkdin,uber,paypal,nasa,walmark,medium,trello,eBay @@@@@@@@ EXPRESSJS @@@@@@@@@ expessjs: is a fast ,minimal and flexible web framwork for nodejs that simplifies building web application abd apis in a more structured and organized way . @@ what is web framwork @@ web frameworks are sets of pre-writen code and libraies that provide a foundation for developing software application @@pre-writen code libraies@@ TOOLS commponets Modules Examble : databse commponets, caching ,pagination,session managemnet,form handling ,security mechanisms,user auth,apis,payment getway BENEFITS: code organization reusbility standardization testing debugging support community and support @@ TYPE OF frameworks @@@ =>Opinionated frameworks => Unopinionated frameworks has a defined architechture No strick rules or predefined workflow. (mvc,mvvm,etc) EXPRESSJS(nodejs) flask(python) ruby on rails(Ruby) fastAPI(python) Django (python) koa.js(nodejs) spring boot(java) REACTJS larravel(php) TOPIC nodejs parameters Requests apis Template ENGINE middleware validation file upload routes cookies auth error handling testing' streams sockets @@@@@@@@@@ Installation download node js CMD COMMAND 2.node -v 3.npm -v pc setting edit the SYSTEM enviroment check enviroment variable=>SYTEM variable=>path=>nodejs path VS CODE extention expressJs 4 Snippets by guray MERN Snippets by mohamed-khaled expressJs snippets by Xpertpk EJS language support(digitalBrainstem) MongoDB for VS code-(MongoDB) path intellisense(Christion) ESLint (microsoft) (findout js error) @@@ start node js project 2.npm init -y () give package.json where provide name version scripts author licence if getting error run these command b.a.Get-ExecutionPolicy Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser again now npm init -y d.Get-ExecutionPolicy -List 3.project run node filename.js eg node index.js EXPESS JS Installation PROCESSING STEP INSTAL nodejs INSTAL VS CODE INSTAL EXPRESSJS NPM INSTALL EXPRESSJS WORK computer ====> request Express js <========Respone crud= create read update delete how to work express js STEP 1 const express = require('express') const app= express() step 2 app.listen(3000,()=>{ console.log('example app listening on port 3000') }) HTTP Requests HTTP://LOCALHOST:3000/ ===> app.get('/',(req,res)=>{ res.sent('hello!') }) HTTP://LOCALHOST:3000/ HTTP://LOCALHOST:3000/ABOUT HTTP://LOCALHOST:3000/GALLERY go package.js and scripting name scripts": { "test": "echo \"Error: no test specified\" && exit 1", "DEVELOPING":"node index.js" }, for live according your package json scripting name npm run DEVELOPING // how to sent requesst (see on your browser ) app.get('/',(req,res)=>{ res.send("i have sent requst in srver") }) ANY package FOR VISIT WEBSITES https://www.npmjs.com/package/nodemon // THIS IS FOR NOT RUN COMMAND AGAIN AGIN COMMAND npm i nodemon ESKE BAD package JSON SCRIPTING ME NAME CHANGE KRNA HAI scripts": { "test": "echo \"Error: no test specified\" && exit 1", "DEVELOPING":"nodemon index.js" }, npm run DEVELOPING EXPRESS JS routes routes UTL WEBPAGE url,APIS url HTML HTTP://LOCALHOST/ABOUT.HTML EXPRESSJS routes HTTP://LOCALHOST:3000/ HTTP://LOCALHOST:3000/ABOUT ->ABC.HTML HTTP://LOCALHOST:3000/ABOUT/USER NETEST routes HTTP://LOCALHOST:300/USR/RUPESHTECH/ROLLNO/233 routes parameters HTTP://LOCALHOST:300/SEARCH?NAME=RUPESHTECH QUERY parameters WHEN TO USE routes HTTP Requests EXPRESSJS READ CREATE UPDATE delete READ=> app.get('/',(req,res)=>{ }) create=> app.post('/',(req,res)=>{ }) upade=>{ app.put('about',(req,res)=>{ }) } delete=> app.delete('about',(req.res)=>{ }) passs the value with the help of route eg http://LOCALHOST:3000/user/20 // route app.get('/user',(req,res)=>{ res.send("<h2>user route for senting messgae</h2>") }) // sent sms route app.get('/user/:userid',(req,res)=>{ res.send(req.params) }) express js SERVR Respone app.get('/user',(req,res)=>{ res.send('HEloo') }) express js respone method res.send() =>text html.object array buffers res.json() =>json(js object notation) res.jsonp()=>jsonp(json with padding) agar alg alg domain se request aa rhi to ese use kre res.redirect() app.get('/old-route', (req, res) => { res.redirect(301'https://www.example.com'); }); res.render()=> open HTML file(any websites) using a template emgine note first install template engine command npm install ejs rs.download()=>pdf,image file,music video ,Excel etc res.send.File()=> res.end() res.sendStatus() res.headerSent() res.set() res.get() lab app.get('/',(req,res)=>{ res.send ( // send json // { name:"RUPESHTECH", // age:34} //sent array ['apple','fruid','cat','dog'] ) }) redirect code hints code description 301 a permanent redirect used when a resource has been moved to new url 302 a temporary used when a resource has been temporary moved to a new url 303 a temporary redirect used after a POST or PUT operations 307 a temporary redirect similar to 302 but better for sites with non-GET operations 308 the permanent counterpart to the 307 redirect. SERVR status code 200 ok 201 created 403 forbidden 404 not found 500 internal server error 503 service unavailable 504 gateway timeout /* Express js REquest properties and method important properties Method req.params req.accepts HTML JSON XML req.query req.get req.body req.is JSON,from data or plain text req.cookies req.range req.hostname req.ip req.ips req.methods req.originalUrl req.path req.protocol req.secure req.route note download post men how to json data in server */ app.use(express.json()) // wrtie This in top for using json format app.use(express.urlencoded({extended:false})) // wrtie This in top sendig from data app.post('/about',(req,res)=>{ res.send(req.body) }) =>go psotmen app=>+ write YOUR URL =>choose method POST =>params=>body=>ROW=>json =>write json filed =>send =>go psotmen app=>+ write YOUR URL =>choose method POST =>params=>body=>x.www-from-data=>key->value=>write from filed =>send app.get('/about/',(req,res)=>{ res.send(req.hostname) res.send(req.hostname) res.send(req.ip) res.send(req.ips) res.send(req.method) res.send(req.originalUrl) res.send(req.path) res.send(req.protocol) res.send(req.secure) res.send(req.route) res.send(req.accepts('html)) })
June-06-2025 21:23:08
June-06-2025 11:35:05
June-06-2025 08:25:42
June-02-2025 21:09:41
June-02-2025 10:56:22
June-02-2025 10:27:58
June-02-2025 10:15:40
May-30-2025 19:20:40
May-30-2025 19:14:29
May-27-2025 21:52:18
May-27-2025 21:33:30
May-26-2025 17:11:41
May-26-2025 16:53:29
May-26-2025 16:50:59
May-13-2025 21:02:32
May-13-2025 17:46:23
May-12-2025 15:41:29