// The newest posts of a feed (here a sample; `http.get(url)?.body` reads a live one).
//
//   quillo run feed.qwe      then open http://localhost:8080/news

use "feed.qwer"

let sample = `<?xml version="1.0"?><rss version="2.0"><channel><title>Quillo blog</title><link>https://quillolang.org/blog/</link>
<item><title>Quillo is the accidental name</title><link>https://quillolang.org/blog/the-accidental-name/</link><pubDate>Tue, 02 Jul 2024 09:00:00 GMT</pubDate></item>
<item><title>A Node is not Enough</title><link>https://quillolang.org/blog/a-node-is-not-enough/</link><pubDate>Mon, 12 Jan 2026 09:00:00 GMT</pubDate></item>
</channel></rss>`

route GET /news {
    let f = feed_parse(sample)?
    { site: f.title, posts: f.entries | map((e) => { title: e.title, link: e.link, published: e.published }) }
}
