Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
meghna786 committed Aug 8, 2020
0 parents commit 1788f9d
Show file tree
Hide file tree
Showing 6 changed files with 789 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
33 changes: 33 additions & 0 deletions app.js
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}`);
})
Loading

0 comments on commit 1788f9d

Please sign in to comment.