-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e772bc1
commit f14f467
Showing
2 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
const express = require('express'); | ||
const app = express(); | ||
const port = 8000; | ||
|
||
|
||
app.get( '/' , (req , res) => { | ||
res.send(` | ||
<h1>Welcome , this is home page</h1> | ||
<input type = "text" placeholder = "user name" /> | ||
<button> Click Me </button> | ||
<a href = '/about'> Go To About </a> | ||
`); | ||
}); | ||
|
||
app.post('/about' , (req , res) => { | ||
res.end(`<h1>Welcome , this is about page</h1> | ||
const data = [ | ||
{ | ||
name:"vivek", | ||
2 : "two" | ||
} , | ||
{ | ||
"name":"vivek", | ||
"addr" : "xyz" | ||
} | ||
] | ||
<a href = '/' > Go To Home </a> | ||
`) | ||
|
||
console.log(req.body) | ||
|
||
|
||
}); | ||
|
||
app.get('/help' , (req , res) => { | ||
res.send('<h1>Welcome this is help page</h1>'); | ||
}) | ||
|
||
|
||
|
||
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); | ||
}); |