diff --git a/query-parems.js b/query-parems.js new file mode 100644 index 0000000..8594e51 --- /dev/null +++ b/query-parems.js @@ -0,0 +1,51 @@ +const express = require('express'); +const app = express(); +const port = 8000; + + +app.get( '/' , (req , res) => { + res.send(` +

Welcome , this is home page

+ + + Go To About +

Accesing quary parems passed from the browser's URL as:- http://localhost:8000/?name=xyz

${req.query.name} + `); + + console.log(req.query.name) +}); + +app.get('/about' , (req , res) => { + res.end(`

Welcome , this is about page

+ const data = [ + { + name:"vivek", + 2 : "two" + } , + + { + "name":"vivek", + "addr" : "xyz" + } + ] + Go To Home + `) + + console.log(req.body) + + +}); + +app.get('/help' , (req , res) => { + res.send('

Welcome this is help page

'); +}) + + + +app.listen(port , (err) => { + if(err){ + console.log(`Error while connecting to server ${err} on PORT ${port}`); + return; + } + console.log('Server running on the port' , port); +}); \ No newline at end of file