Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/codesardine/corsfeedreader


https://github.com/codesardine/corsfeedreader

Last synced: 4 days ago
JSON representation

Awesome Lists containing this project

README

        

# corsFeedReader

Feed reader using fetch API, Only works on same domain, unless you set [cors](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) server side for external domains, supports RSS format.

### Setting Cors
[Nginx](https://enable-cors.org/server_nginx.html)

[Apache](https://enable-cors.org/server_apache.html)

### Build
```
npm install --save-dev @babel/core @babel/cli @babel/preset-env @babel/preset-minify
npm run build
Output: ./build/corsFeedReader.min.js
```
### Usage
```
const myFeed = new CorsFeedReader(".appendTo-selector", {
fetchAPI: 'https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch'
}, {
feedUrl: "https://forum.manjaro.org/c/announcements/stable-updates.rss",
dev: true,
items: 5,
template: `



{{ title }}




{{ pubDate }}

{{ description }}

`,
beforeTemplate: function(content) {
// do something with content
},
afterTemplate: function(content) {
// do something with content
}
});
```