sharkey/src/web/service/rss-proxy.ts
Aya Morisawa e52885bfe4
2017-01-03 06:03:19 +09:00

17 lines
350 B
TypeScript

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) {
console.error(err);
return;
}
res.send(xml2json.toJson(xml));
});
};