node package manager
Easy sharing. Manage teams and permissions with one click. Create a free org »



RSS XML-blahfoo to liteweight JSON / HTML converter middleware

This software is probably not ready for general consumption, as it was built for a very specific purpose.

In your Express server's, add a request handler like this:

app.get '/vouchers/:tags?'( request, response ) ->
  request_tags  = RSS.normalize_tags ( request.params[ 'tags' ? '' ).split ','
  url           = "{request_tags.join ','}/feed" url( error, rss ) =>
   ### `rss` now contains all entries with *any* of the tags; next we filter out all entries that are not
   *not* marked with *all* of the tags specified in the request: ###
    rss = RSS.filter_for_tags rssrequest_tags
    response.json rss

Here is what you could do on an HTML page to fetch the RSS and display its entries:

$( document ).ready ->
    tags = 'berlin,vodafone'
    $.get "/vouchers/#{tags}"( rss, status, jqXHR ) ->
        # if status isnt 'success' 
        vouchers = []
        for entry in rss
            vouchers.push "<div class='entry'>#{entry[ 'content' ]}</div>"
        ( $ '#vouchers' ).html vouchers.join '\n'