@pinknews/nestjs_rss_interceptor
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

This adds a RssInterceptor, which deals with turning a data blob from your controller to valid rss compliant xml.

Your controller should return a RssChannel instance, which mirrors the rss spec https://validator.w3.org/feed/docs/rss2.html.

@Controller()
export class RssController {
    @Get('rss')
    @UseInterceptors(RssInterceptor)
    getRss() {
        return {
            title: 'My RSS feed',
            description: 'This is my rss feed',
            link: 'http://example.com/rss',
            items: [
                {
                    title: 'This is item 1 in the feed',
                    description: 'This is longer description of how this is item 1 in the feed',
                    link: 'http://example.com/rss/1',
                },
                {
                    title: 'This is item 2. It's a bit simpler'
                }
            ]
        };
    }
}

Readme

Keywords

Package Sidebar

Install

npm i @pinknews/nestjs_rss_interceptor

Weekly Downloads

1

Version

1.0.7

License

MIT

Unpacked Size

108 kB

Total Files

10

Last publish

Collaborators

  • samdeanpinknews