Analytics counter using couch and couchApp

Couch has a REST interface. This means that data updates are exclusive to PUT calls.

I learn how to implement modest analytics counters and come up with the couchdb, couch, and couchapp functions - which are kin'da cool, keeping in mind my strong JavaScript orientation.

However, most web analytics services end up making counter update calls, requesting some resource, usually in the IMG or SCRIPT tag.

  • Is there a way to use couchApp to use a GET request to execute my bills?
  • Will it be architecture abuse? I mean, not everything on the couch - REST - i, g, - is not part of the administration.

I would be very happy to hear what the experts say :)

** Changed *

I just noted that CouchDB and Sofa come with a Mochiweb web server! Maybe there is a way I could do this?

+3
source share
1 answer

Plug or plug idea

If you are an Erlang programmer (or you are looking for a new project to learn Erlang), then you can definitely write whatever you want as a plugin / extension for CouchDB. The smallest example I know is Die CouchDB, my proof of concept, which adds a single request that just stops the server.

https://github.com/iriscouch/die_couchdb

Basically, you could write a CouchDB plugin or fork to handle GET requests and do something with them.

REST Architecture Note

, REST HTTP , GET / ( 50 ).

: GET , . ; , , - , .

, , .

, , Couch, . , /_log . IP- , .

$ curl -X GET http://localhost:5984/?userid=abcde\&windowsize=1024x768\&color=blue
{"couchdb":"Welcome","version":"1.1.0"}

$ curl localhost:5984/_log | grep userid
[Mon, 23 May 2011 00:34:54 GMT] [info] [<0.1409.0>] 127.0.0.1 - - 'GET' /?userid=abcde&windowsize=1024x768&color=blue 200

.

-, GET , . NodeJS , -, : PHP, ASP, JSP, .

GET , , , relavant .

!

+3
source

All Articles