egirlskey/src/web/service/rss-proxy.ts

17 lines
350 B
TypeScript
Raw Normal View History

2016-12-28 22:49:51 +00:00
import * as express from 'express';
import * as request from 'request';
2017-01-02 21:03:19 +00:00
import xml2json = require('xml2json');
2016-12-28 22:49:51 +00:00
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));
});
};