-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreq_to_adm.js
31 lines (27 loc) · 1.17 KB
/
req_to_adm.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
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var urlencodedParser = bodyParser.urlencoded({ extended: false })
var mysql = require('mysql');
let final;
app.post('/monk' , function (req, res) {
var con = mysql.createConnection({
host: "localhost",
user: "root",
password: "",
database: "upi"
});
con.connect(function(error) {
if (error) throw error;
console.log("Connected!");
let add_no = req.body.aadhar_number ;
var sql = "INSERT INTO request_to_admin (Amount , Aadhar_no ,Account_no , Doc , status , Name , Email , Phone_no , Bank) VALUES ( '"+ req.body.amount +"','"+ add_no +"','"+ add_no + Math.floor(Math.random() * 100) +"','"+ req.body.amountp +"',' NULL ','"+ req.body.name +"','"+ req.body.email +"','"+ req.body.phone_number +"' ,'"+req.body.Bank +"')";
con.query(sql, function (error, result) {
if (error) throw error;
console.log('account created');
});
});
console.log("response");
res.end(JSON.stringify("Request is send to admin , he will create your account and your account number and password is send to your entered email "),);
})
module.exports = app;