0
0
switched/src/web/service/rss-proxy.ts

16 lines
351 B
TypeScript
Raw Normal View History

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