Change URL method to work with older nodejs versions



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@58699 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-05-14 16:48:40 +00:00
parent 36ff7b58a8
commit cfed36d65b
1 changed files with 2 additions and 1 deletions

View File

@ -5,6 +5,7 @@ let app = express();
let mcache = require('memory-cache');
const request = require('superagent');
const prom = require('prom-client');
const URL = require('url');
let cors = require('cors');
app.use(cors());
@ -38,7 +39,7 @@ let cache = (duration) => {
if(req.query.url) {
let key = '__express__' + req.query.url;
let cachedBody = mcache.get(key);
const url = new URL(req.query.url);
const url = new URL.parse(req.query.url);
const target = url.host + '/' + url.pathname.split('/')[1];
const scheme = url.protocol.replace(':', '');
if (cachedBody) {