summaryrefslogtreecommitdiff
path: root/src/web/service/rss-proxy.ts
blob: 8cc3711e701dbb819065b6afd48878c1562f3a16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import * as express from 'express';
import * as request from 'request';
const xml2json = require('xml2json');

module.exports = (req: express.Request, res: express.Response) => {
	const url: string = req.body.url;

	request(url, (err, response, xml) => {
		if (err) {
			console.error(err);
			return;
		}

		res.send(xml2json.toJson(xml));
	});
};