Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Middleware for MongoDB or CouchDB with jQuery Ajax/JSON frontend

I've been using the following web development stack for a few years:

java/spring/hibernate/mysql/jetty/wicket/jquery

For certain requirements, I'm considering switching to a NoSQL datastore with an AJAX frontend. I would probably build the frontend with jQuery and communicate with the web application middleware using JSON. I'm leaning toward MongoDB because of more dynamic query capabilities, but am still considering CouchDB.

I'm not sure what to use in the middle. Probably something RESTful? My preference is to stick with Java (or maybe Scala or Groovy) since I'm using tools like Drools for rules and Shiro for security. But then again, I want to pick something that is quick an easy to work with, so I'm open to other solutions.

If you are building ajax/json/nosql solutions, I'd like to hear details about what tools you are using and any pros/cons you've found to using them.

like image 726
Tauren Avatar asked Nov 28 '09 19:11

Tauren


2 Answers

  1. Pick whichever middleware you are most comfortable with.

  2. CouchApp is very experimental at the moment. The main issue is being able to add security to your app without having a standard HTTP pop-up box. This is obviously a big issue for standard web apps.

  3. Try and avoid parsing each DB request in the middleware and rebuilding the query for couchdb. You can make your middleware act like a proxy so most requests are forwarded on without modification. You can also add a security layer in the middlelayer on top of all requests that need authentication.

  4. Pick a middleware/framework with good URL routing capabilities. For example you could route all requests that go to mydomain.com/db/ to couchdb.

like image 61
andyuk Avatar answered Oct 11 '22 17:10

andyuk


If you go with CouchDB, you can use CouchApp which is a set of scripts for deploying an application directly to a CouchDB database. In essence, you skip the middleware and use CouchDB's views, lists, and show functions along with clientside JavaScript to implement the whole app. If your app works in this architecture, it's surprisingly refreshing, simple and cool.

like image 28
Barry Wark Avatar answered Oct 11 '22 17:10

Barry Wark