Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I render xml/rss in expressjs 4.x?

I am creating a route to handle RSS feeds using the rss npm module.

I've generated the appropriate xml string, I just need to know how to output xml/rss using proper headers with express 4.0.

I tried this but it doesn't work, I get an empty json object:

res.xml(xml);
like image 247
chovy Avatar asked Sep 17 '25 00:09

chovy


1 Answers

Figured it out:

res.set('Content-Type', 'application/rss+xml');
res.send(xml);
like image 50
chovy Avatar answered Sep 19 '25 14:09

chovy