Skip to content

Installing Server Components

sebs edited this page Sep 14, 2010 · 8 revisions

CouchDB

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

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

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/

CouchApp

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

Configs

CouchDB

  • Create a Database named geogame in the couchdb.
  • Checkout the gtug HTML5 git repo, cd into the geogame folder and do ‘’couchapp push’’

NodeJS

  • cd into the nodejs folder of the gtup HTML5 git repo and do ‘’node server.js’’ . The Server is now up and running

Testit

You have curl ait? So let’s do some http with the client

Add Coords for a User

  • 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

Get Coords for all user

  • 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"}]

Get Coords for a specific user

  • 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"}]
Clone this wiki locally