-
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
0 parents
commit 1788f9d
Showing
6 changed files
with
789 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
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,33 @@ | ||
const express=require("express"); | ||
const fs=require("fs"); | ||
const appl=express(); | ||
const path=require("path"); | ||
const port=80; | ||
|
||
appl.use(express.urlencoded()); | ||
appl.use('/static',express.static('stat')); | ||
|
||
appl.set('view engine','pug'); | ||
appl.set('views',path.join(__dirname,'views')); | ||
|
||
appl.get('/',(req,res)=>{ | ||
res.status(200).render('index.pug'); | ||
}) | ||
|
||
appl.post('/',(req,res)=>{ | ||
name=req.body.name; | ||
surname=req.body.surname; | ||
number=req.body.number; | ||
email=req.body.email; | ||
address=req.body.address; | ||
|
||
let outputSTR=`The name of the client is ${name} ${surname}, contact number is ${number}, Email ID is ${email} and address is ${address} . \n\n`; | ||
fs.appendFileSync('output.txt',outputSTR); | ||
|
||
const data={'message':'Your Form has been submitted successfully'}; | ||
res.status(200).render('index.pug'); | ||
}) | ||
|
||
appl.listen(port,()=>{ | ||
console.log(`the application started successfully on port ${port}`); | ||
}) |
Oops, something went wrong.