-
Notifications
You must be signed in to change notification settings - Fork 0
Installing Server Components
CouchDB will store the data of the users. Install CouchDB from http://couchdb.apache.org/
We used Version 0.11, maybe 1.x will do as well
Loca
NodeJS is the base of our AJAX/Rest Endpoint and basically acting as a proxy to the couchdb views and HTTP Methods.
Install NodeJS from: http://nodejs.org/#build
ExpressJS provides the glue code to actually make a Ajax/Rest Endpoint happen. It defines a routing and provides JSON results of the data as well as “error messages”. Watch out for keyboardcat!!!
Install from http://expressjs.com/
This one is used to deploy the couchdb views etc. into your couchDB database. It has a hole lot of functionality we didn’t use but command line deployment of view code w.o. the hassle of abstracting that to curl makes it worth the installation.
Get couchApp from: http://github.com/couchapp/couchapp
- Create a Database named geogame in the couchdb.
- Checkout the gtug HTML5 git repo, cd into the geogame folder and do ‘’couchapp push’’
- cd into the nodejs folder of the gtup HTML5 git repo and do ‘’node server.js’’ . The Server is now up and running
You have curl ait? So let’s do some http with the client
curl -d 'data=[{"id":"12.12.2010 09:00:00","lat":12.121231,"long":32.321131,"heading":33,"speed":2,"user":"hans"},{"id":"12.12.2010 09:00:00","lat":12.121231,"long":32.321131,"heading":33,"speed":2,"user":"foo"}]' http://localhost:3000/own/larry
- This should add some data and NOT result in a error 500
curl -X GET http://localhost:3000/all/
[{"id":"12.12.2010 09:00:00","lat":12.121231,"long":32.321131,"heading":33,"speed":2,"user":"larry"},{"id":"12.12.2010 09:00:00","lat":12.121231,"long":32.321131,"heading":33,"speed":2,"user":"larry"}]
curl -X GET http://localhost:3000/own/larry
[{"id":"12.12.2010 09:00:00","lat":12.121231,"long":32.321131,"heading":33,"speed":2,"user":"larry"},{"id":"12.12.2010 09:00:00","lat":12.121231,"long":32.321131,"heading":33,"speed":2,"user":"larry"}]