This is the server backend for the Futurice mGraffiti project. mGraffiti is a service that took part in the Nokia World 2011 Hackathon event, with both Windows Phone 7 and QT mobile client versions. It won the best QT app prize. The backend is a couple of days worth of work - with a few more to add some (Spock/Geb) tests and perform a bit of refactoring.
The application is running here, if you want to check it out, although the web page isn't much to look at.
The app is essentially a 'virtual toilet wall', on which users can paint using the mobile clients. More technically, using a REST-lite JSON API, you can:
- Create new walls, and associate them with lat/lon coordinates and/or a NFC tag. (For the initial version, all walls are given a preset background image - custom background can be easily supported.)
- Query for walls by proximity or NFC tag.
- Get the images for the walls.
- Add an image layer to a wall.
Currently:
Download the dependencies above, install them on a given machine, and run 'grails run-app' - you should have a working instance of the backend app. Why? Might be useful for learning MongoDB/Grails/Spock/Geb... Also feel free to create your own clients if you wish!
To run the tests, it's easiest to run 'grails dev test-app :spock'. To generate a CodeNarc report, 'grails codenarc' - although the ruleset doesn't fully support Grails 2.0.
The meat and potatoes of the application.
- GET /rest/wall?lat=61.12&lon=26.16&radius=100: list walls near location (with optional max distance in km)
- GET /rest/wall?nfcId=abc123: get wall by NFC tag ID
- GET /rest/wall/:wallId/image: get (flattened) image for wall as PNG, without background (only transparency)
- GET /rest/wall/:wallId/webImage: get (flattened) image for wall as JPG, with background
- POST/PUT /rest/wall/:wallId/image: add layer to wall image (PNG in request body, must match dimensions of background image - 2000x800 px for now)
- POST/PUT /rest/wall: create wall. Data as application/json payload in request, e.g.:
{"title": "test", "creatorName": "dudeman12", location: {"lat":12.132, "lon":13.456}, "nfcId": "nfcTagGoesHere"}