router.js
1.16 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
var express = require('express');
var router = express.Router();
var dynamo_access = require('./dynamodb.js')
// router.post('/app/save_data',function(req,res,next){
// var body = req.body;
// dynamo_access.save_app_data(body,function(response){
// console.log(response)
// if(response == true) res.status(200).json("Success")
// else res.status(500).json("Fail")
// });
// })
router.get('/app/get_data/:id',function(req,res,next){
dynamo_access.get_user_data(req.params.id,function(response){
console.log(response)
res.status(200).json(response)
})
})
router.post('/app/get_diff_data',function(req,res,next){
var body = req.body;
console.log(body);
dynamo_access.get_diff_data(body,function(response){
console.log(response)
res.status(200).json(response)
})
})
router.post('/pi/save_data',function(req,res,next){
var body = req.body;
console.log(body);
dynamo_access.save_pi_data(body,function(response){
console.log(response)
if(response == true) res.status(200).json("Success")
else res.status(500).json("Fail")
});
})
module.exports = router;