diff --git a/express.js b/express.js index 7d6bb9f..a5b7b9f 100644 --- a/express.js +++ b/express.js @@ -16,4 +16,4 @@ app.get('/help' , (req , res) => { app.listen(8000 , () => { console.log('Server running on the port 8000') -}); \ No newline at end of file +}); \ No newline at end of file diff --git a/html and json.js b/html and json.js new file mode 100644 index 0000000..d282d79 --- /dev/null +++ b/html and json.js @@ -0,0 +1,48 @@ +const express = require('express'); +const app = express(); +const port = 8000; + + +app.get( '/' , (req , res) => { + res.send(` +

Welcome , this is home page

+ + + Go To About + `); +}); + +app.post('/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