I am trying to generate a rss.xml
file for my angular 8 app with ssr + firebase + gcp inside the domain.
I've created a RssComponent
which can be reached at /rss
route. There i call getNews()
method and recieve an array of objects. Then I make a http request to /api/rss
and in server.ts
i handle that request:
app.post('/api/rss', (req, res) => {
const data = req.body.data;
const feedOptions = // defining options here
const feed = new RSS(feedOptions);
data.forEach((item) => {
feed.item({
title: item.headingUa,
description: item.data[0].dataUa,
url: item.rssLink,
guid: item.id,
date: item.utcDate,
enclosure: {url: item.mainImg.url.toString().replace('&', '&'), type: 'image/jpeg'}
});
});
const xml = feed.xml({indent: true});
fs.chmod('dist/browser/rss.xml', 0o600, () => {
fs.writeFile('dist/browser/rss.xml', xml, 'utf8', function() {
res.status(200).end();
});
});
});
And finally on response i'm opening the recently generated rss.xml
file in RssComponent
. Locally everyting is working fine but on google cloud platform it's not generating a file.
question from:
https://stackoverflow.com/questions/65920730/genrating-rss-xml-for-angular-8-app-locally-works-fine-but-not-on-prod 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…