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

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

	request(url, (err, response, xml) => {
		if (err) {
			res.sendStatus(500);
		} else {
			res.send(xml2json.toJson(xml));
		}
	});
};