-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubmitrequest.js
More file actions
44 lines (31 loc) · 1.14 KB
/
submitrequest.js
File metadata and controls
44 lines (31 loc) · 1.14 KB
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
var express = require('express');
var router = express.Router();
var mongo = require('mongodb').MongoClient;
var assert = require('assert');
/* GET users listing. */
var url = 'mongodb://localhost:27017/Greenlight';
var resultArray = [];
router.post('/', function(req, res, next) {
var Name = req.body.Name;
var CNICNo = req.body.CNICNo;
var Email = req.body.Email;
var MobileNo = req.body.MobileNo;
var DateOfVisit = req.body.DateOfVisit;
var TimeOfVisit = req.body.TimeOfVisit;
var CarPlateNo = req.body.CarPlateNo;
var Role= req.body.RoleName;
mongo.connect(url, function(err, db ) {
assert.equal(null, err);
db.collection('Requests').insertOne({Name:Name , CNICNo:CNICNo ,Email:Email, MobileNo:MobileNo ,DateOfVisit:DateOfVisit,TimeOfVisit:TimeOfVisit,CarPlateNo:CarPlateNo, roleName:Role},
function (error) {
if(error) {
res.send("dont");
// return
} else {
res.send("do");
// return
}
});
});
});
module.exports = router;