Summary Table
Categories |
Total Count |
PII |
0 |
URL |
0 |
DNS |
0 |
EKL |
0 |
IP |
0 |
PORT |
0 |
VsID |
0 |
CF |
0 |
AI |
0 |
VPD |
0 |
PL |
0 |
Other |
0 |
File Content
const express = require('express');
const router = express.Router();
const rest = require('../../rest/rest');
router.get('/userInfo/:userName', (req, res) => {
const userName = encodeURIComponent(req.params.userName);
const system = req.query.system;
// const id = req.params.id;
rest
.getResource(
process.env.END_POINT_BASE_URI +
process.env.GET_USERDETAILS +
'/' +
userName +
`?system=${system}`
)
.then(data => {
// console.log('data from userInfo', data.responseBody);
res.status(data.response.statusCode).json(data.responseBody);
})
.catch(error => {
console.log('Reports getStations error ', error);
});
});
router.post('/userInfo', (req, res) => {
rest
.postResource(
process.env.END_POINT_BASE_URI + process.env.LIST_ALLUSERS + '/',
req.body
)
.then(data => {
res.status(data.response.statusCode).json(data.responseBody);
})
.catch(error => {
console.log('Reports getStations error ', error);
});
});
//rest call to delete user
router.get('/deleteUserInfo/:userId', (req, res) => {
const userId = req.params.userId;
// const id = req.params.id;
rest
.getResource(
process.env.END_POINT_BASE_URI + process.env.DELETE_USER + '/' + userId
)
.then(data => {
// console.log(
// process.env.END_POINT_BASE_URI + process.env.DELETE_USER + '/' + userId
// );
res.status(data.response.statusCode).json(data.responseBody);
})
.catch(error => {
console.log('Reports getStations error ', error);
});
});
//Rest Call for Create USer
router.post('/createUser', (req, res) => {
rest
.postResource(
process.env.END_POINT_BASE_URI + process.env.CREATE_USER + '/',
req.body
)
.then(data => {
res.status(data.response.statusCode).json(data.responseBody);
})
.catch(error => {
console.log('Reports getStations error ', error);
});
});
//Rest Call for Edit USer
router.post('/editUser', (req, res) => {
rest
.postResource(
process.env.END_POINT_BASE_URI + process.env.EDIT_USER + '/',
req.body
)
.then(data => {
res.status(data.response.statusCode).json(data.responseBody);
})
.catch(error => {
console.log('Reports getStations error ', error);
});
});
module.exports = router;