Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/codesardine/corsfeedreader
https://github.com/codesardine/corsfeedreader
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/codesardine/corsfeedreader
- Owner: codesardine
- License: mit
- Created: 2020-01-19T02:00:53.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-12-29T20:14:56.000Z (almost 4 years ago)
- Last Synced: 2023-06-10T11:51:54.033Z (over 1 year ago)
- Language: JavaScript
- Size: 11.7 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
}
});
```