mirror of
https://gitlab.silvrtree.co.uk/martind2000/mdot_server.git
synced 2025-01-30 23:10:15 +00:00
48 lines
955 B
JavaScript
48 lines
955 B
JavaScript
|
var logger = require('log4js').getLogger();
|
||
|
var util = require('util');
|
||
|
|
||
|
var mdot = require('./mdot.js');
|
||
|
|
||
|
module.exports = function(app) {
|
||
|
var express = require('express');
|
||
|
var mdotRouter = express.Router();
|
||
|
|
||
|
mdotRouter.get('/:id', function(req, res) {
|
||
|
console.log(req.headers);
|
||
|
|
||
|
var data = {};
|
||
|
logger.debug('mDot-GetData');
|
||
|
logger.debug(req);
|
||
|
|
||
|
if (!req.params.id) {
|
||
|
logger.error('MDot','Missing required paramter');
|
||
|
res.status(400).send({
|
||
|
status: 'error',
|
||
|
error: 'missing required parameter'
|
||
|
});
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
logger.debug(req.params.id);
|
||
|
|
||
|
if (req.params.hasOwnProperty('id')) {
|
||
|
data.id = req.params.id;
|
||
|
|
||
|
logger.debug(data);
|
||
|
|
||
|
|
||
|
mdot.doGet()
|
||
|
.then(() => {
|
||
|
'use strict';
|
||
|
console.log('outside the promise');
|
||
|
});
|
||
|
|
||
|
//logger.debug(util.inspect(mdot,{showHidden:true}));
|
||
|
}
|
||
|
|
||
|
});
|
||
|
|
||
|
app.use('/api/mdot/', mdotRouter);
|
||
|
};
|
||
|
|