Node-Angular and Nosql App

I have created a simple web application using Node.js(Expres) on server-side.DB is Couchbase and using client as Angular.js

Basically,it is displaying data stored on couchbase using different views(queries if we speak in relational db terms).Data comes from The Guardian Open Data Platform via another app that i wrote.It is bringing various articles from Guardian website using the API that is served.By the way,i highly recommend anyone to have a look at The Guardian Open Data Platform.

Guardian Newspaper Football Content

It is using express web application framework for server side operations.REST services are defined and connecting to and querying couchbase is implemented inside.Getting and querying data from a nosql db -including map-reduce functions- is showcased here.

<br /><%%KEEPWHITESPACE%%>  var db = new couchbase.Connection( config, function( err ) {<br /><%%KEEPWHITESPACE%%>    if(err) {<br /><%%KEEPWHITESPACE%%>      console.error("Failed to connect to cluster: " + err);<br /><%%KEEPWHITESPACE%%>      process.exit(1);<br /><%%KEEPWHITESPACE%%>    }<br /><br /><%%KEEPWHITESPACE%%>    console.log('Couchbase Connected');<br /><%%KEEPWHITESPACE%%>  });<br /><br /><%%KEEPWHITESPACE%%>  var params = { limit:1000, reduce:false};<br /><%%KEEPWHITESPACE%%>  params.key =category;<br /><%%KEEPWHITESPACE%%>    db.view( "dev_news", "news_by_section", params).query(function(err, results) {<br /><br /><%%KEEPWHITESPACE%%>      res.json({<br /><%%KEEPWHITESPACE%%>        posts: results<br /><%%KEEPWHITESPACE%%>      });<br /><%%KEEPWHITESPACE%%>    });<br /><br />

On client-side Angular.js is used as MVC javascript framework.For templating, Jade is in place.

All in all,two things to install and run as well as source code of course available in Github:

  1. Data populator using The Guardian Open Data platform:https://github.com/selmantayyar/GuardianRestClient
  2. Actual web application:https://github.com/selmantayyar/guardian-news-content

README files have clear instructions for installation.

Please let me know if you face any issues.

Next step is to do content base search using ElasticSearch.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s