aviatesrv/server.js
Martin Donnelly 0a796308e2 logging
2019-02-20 14:51:51 +00:00

79 lines
1.9 KiB
JavaScript

const express = require('express');
const app = express();
const port = 3434;
app.get('/v2/broadway/cards', (req, res) => {
console.log('-+-+-+-+-+-+-+-');
console.log('originalUrl', req.originalUrl);
console.log('Headers', req.headers);
console.log('query', req.query);
console.log('\n\n\n');
res.set('Content-Type', 'text/xml');
res.send("<BEGIN_OBJECT></BEGIN_OBJECT>")
});
app.get('/v1/test/getcrumb', (req, res) => {
console.log('-+-+-+-+-+-+-+-');
console.log('originalUrl', req.originalUrl);
console.log('Headers', req.headers);
console.log('query', req.query);
console.log('\n\n\n');
res.send("LvnvxRvdbc")
});
app.get('/v2/get_device', (req, res) => {
console.log('-+-+-+-+-+-+-+-');
console.log('originalUrl', req.originalUrl);
console.log('Headers', req.headers);
console.log('query', req.query);
console.log('\n\n\n');
const obj = {};
obj.rid = req.headers['x-rid'];
obj.did = req.headers['x-ya-did'];
obj.yaDid = obj.did;
obj.crumb = 'LvnvxRvdbc';
console.log(JSON.stringify(obj));
res.send(JSON.stringify(obj));
});
/*
originalUrl /v2/get_device?crumb=LvnvxRvdbc&deviceId=b5280075a297b2f3
{ host: 'aviate.silvrtree.co.uk',
14|server | connection: 'close',
14|server | 'x-rid': '8b244c59-2e7c-4954-8fd7-78533a68cdc6',
14|server | 'x-ya-did': 'b5280075a297b2f3',
14|server | cookie: 'B=13rct8aaothl7',
14|server | 'user-agent': 'Dalvik/2.1.0 (Linux; U; Android 6.0; Android SDK built for x86_64 Build/MASTER)',
14|server | 'accept-encoding': 'gzip' }
14|server | query { crumb: 'LvnvxRvdbc', deviceId: 'b5280075a297b2f3' }
*/
app.get('*', (req, res) => {
console.log('-+-+-+-+-+-+-+-');
console.log('originalUrl', req.originalUrl);
console.log('Headers', req.headers);
console.log('query', req.query);
console.log('\n\n\n');
res.send("LvnvxRvdbc")
});
app.listen(port, () => console.log(`Example app listening on port ${port}!`));