https://github.com/adieuadieu/graphql-web-feeds
Query web feeds (RSS, Atom, and RDF) with GraphQL
https://github.com/adieuadieu/graphql-web-feeds
atom graphql rdf rss web-feed
Last synced: 2 months ago
JSON representation
Query web feeds (RSS, Atom, and RDF) with GraphQL
- Host: GitHub
- URL: https://github.com/adieuadieu/graphql-web-feeds
- Owner: adieuadieu
- License: mit
- Created: 2016-10-05T15:40:29.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-19T06:31:51.000Z (over 8 years ago)
- Last Synced: 2025-03-16T22:23:34.366Z (2 months ago)
- Topics: atom, graphql, rdf, rss, web-feed
- Language: JavaScript
- Homepage:
- Size: 58.6 KB
- Stars: 9
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GraphQL Web Feeds
Reconciling old shit with new shit; Query web feeds (RSS, Atom, and RDF) with GraphQL## Contents
1. [What is it?](#what-is-it)
1. [Try it](#try-it)
1. [Installation](#installation)
1. [Querying](#querying)
1. [Configuration](#configuration)
1. [Testing](#testing)
1. [Troubleshooting](#troubleshooting)## What is it?
Sometimes you gotta make use of an RSS/Atom/RDF web feed. `graphql-web-feeds` aims to make it easy to do that in your GraphQL API.
## Try it
Demo Todo :-(
## Features / Roadmap-todo
- [ ] make it do something
- [ ] S3 cache, use S3 expiration to expire based on RSS TTL
- [ ] aggregate multiple feeds into one, sorted by date (at the detriment of speed?)
- [ ] offer an Atom/RDF/RSS Interface type ?## Installation
The package makes the assumption that, because you're using GraphQL, you're probably also using ES6+ and therefore your project handles any necessary transpilation, when required.
First, install the package:
```bash
npm install graphql-web-feeds --save
```Then, add it to your project's GraphQL schema:
```js
import { GraphQLSchema } from 'graphql/type'
import { feedTypeFactory } from 'web-feeds-graphql'const simpleField = feedTypeFactory()
const schema = GraphQLSchema({
query: simpleField,
})
``````graphql
query {
waitButWhy: feed(url: "http://waitbutwhy.com/feed") {
title
link
description
items {
title
link
description
}
}
}
```Single, default feed:
```js
import { GraphQLSchema } from 'graphql/type'
import { feedTypeFactory } from 'web-feeds-graphql'const feedUrl = 'http://waitbutwhy.com/feed'
const field = feedTypeFactory(feedUrl)const schema = GraphQLSchema({
query: field,
})
``````graphql
query {
feed {
title
link
description
items {
title
link
description
}
}
}
```With cache and selected feeds:
```js
import { GraphQLSchema } from 'graphql/type'
import { S3Cache } from 'web-feeds-graphql/cache'
import { feedTypeFactory } from 'web-feeds-graphql'const cache = new S3Cache({ secret, accesskey, ttl: true, ..etc })
const feeds = {
waitButWhy: 'http://waitbutwhy.com/feed',
spacex: 'http://www.space.com/home/feed/site.xml',
}
const field = feedTypeFactory(feeds, cache)const schema = GraphQLSchema({
query: field,
})
``````graphql
query {
waitButWhy: feed(name: waitButWhy) {
title
link
description
items {
title
link
description
}
}
}
```## Querying
```graphql
query {
waitButWhy: feed(url: "http://waitbutwhy.com/feed") {
title
link
description
items {
title
link
description
}
}
}
```## Configuration
Todo
## Custom Feed Caches
Todo
Cache must be an object exposing two methods: `get` and `set`
stream get(feedUrl)
async set(feedUrl, feedStream)
## Testing
```bash
git clone https://github.com/adieuadieu/graphql-web-feeds.git
cd graphql-web-feeds
npm test
```## FAQ / Troubleshooting
Todo?
Todo.