The only overhead, I think, is the part that I have to actually write the code to fetch RSS content in JavaScript (worker.js), as fool as you can imagine:
const url = request.url.match(/url=(.*)/);
if (url && url.length > 1) {
const feeds = url[1].split(',');
let promises = feeds.map(async url => {
const res = await fetch(url);
const text = await res.text();
const json = JSON.parse(parse(text));
return json && json.feed || [];
});
let result = await Promise.all(promises);
let combined = result.reduce((arr, feed) => {
arr = arr.concat(feed);
return arr;
}, []);
return new Response(JSON.stringify({ "items": combined }), {status: 200, headers: {
'Content-Type': 'application/json'
}});
}
If network libraries such as `reqwest`, and some date parser libraries like `chrono` already supported WASM, I'd be able to skip this JS step for good.
Deployed on Cloudflare using Wrangler CLI, I'm still on my free plan, and I hope I won't hit a 100k requests/day limit anytime soon.
It is cool, but it is not really an application in the expected sense. It is just a 2 stage RSS to HTML converter (e.g. RSS->JSON server, JSON->HTML client).
Not sure why not make just do RSS->HTML directly on the server.
Obviously, does not track read state or sync, or anything else basically.
Here's a bit behind this app.
- Frontend: Just few lines of code using Svelte
- Backend: a Worker Script using Rust, here's how I do the RSS to JSON stuff:
The only overhead, I think, is the part that I have to actually write the code to fetch RSS content in JavaScript (worker.js), as fool as you can imagine: If network libraries such as `reqwest`, and some date parser libraries like `chrono` already supported WASM, I'd be able to skip this JS step for good.Deployed on Cloudflare using Wrangler CLI, I'm still on my free plan, and I hope I won't hit a 100k requests/day limit anytime soon.