Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

PinkNews/nestjs_rss_interceptor

Repository files navigation

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'
                }
            ]
        };
    }
}

Releases

No releases published

Packages

No packages published