Use external service for rss xml to json
This commit is contained in:
parent
f1c02ca7e5
commit
3f54fb8a2a
4 changed files with 7 additions and 26 deletions
|
|
@ -1,15 +0,0 @@
|
|||
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));
|
||||
}
|
||||
});
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue