-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
45 lines (31 loc) · 1.06 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const express=require('express')
const app=express()
const bodyParser=require('body-parser')
const path = require('path')
const sha256=require('sha256')
app.use(bodyParser.urlencoded({
extended: true
}));
app.use(express.json());
app.get('/',(req,res)=>{
var currentdate = new Date();
var datetime = `${currentdate.getDate()}${(currentdate.getMonth()+1)}${currentdate.getFullYear()}${currentdate.getHours()}${currentdate.getMinutes()}${currentdate.getSeconds()}`;
datetimeHash = sha256(datetime)
console.log(datetime)
res.sendfile('india.html')
})
app.post('/',(req,res)=>{
radio=req.body.rad
pincode=req.body.pincode
value={
radio,
pincode
}
var currentdate = new Date();
var datetime = `${currentdate.getDate()}${(currentdate.getMonth()+1)}${currentdate.getFullYear()}${currentdate.getHours()}${currentdate.getMinutes()}${currentdate.getSeconds()}${value.radio}${value.pincode}`;
console.log(req.body)
res.json(datetime)
})
app.listen(3000,()=>{
console.log('server started at 3000')
})