This is an example JavaScript application which uses Backbone and Requirejs. It uses Jam for package management and has a set of tests written with Jasmine. It uses Grunt (0.4) as a build tool.
It uses the Geolocation API and the Instagram API to show a set of nearby photos.
You will need Node.js and NPM installed. Visit the Node.js website for instructions for your OS.
- Clone the repo:
$ git clone git@github.com:mrappleton/localgram.git- Install build dependencies (these are listed in
package.jsonunderdevDependencies):
$ npm install- Install front end dependencies:
$ jam install- Rename
js/constants.js.exampletojs/constants.js:
$ mv js/constants.js.example js/constants.js-
Visit Instagram and register an API client. Copy your
client_idintojs/contants.js. -
Run the development server and visit http://localhost:8000/ in a browser.
$ grunt connect:devThis project includes a number of Grunt build tasks:
-
grunt jshint: Runs all JavaScript against JSHint. -
grunt spec: Runs Jasmine tests in a headless PhantomJS instance. -
grunt spec-serverbuilds the Jasmine spec runner file and starts a server to view it in a browser. Visit http://localhost:1337/_SpecRunner.html for easier test debugging
The application is split across may different files. THey can be built together into a single file suitable for production deployment by running:
$ jam compile build/app.jsThis run the r.js optimizer and put the compiled output into
build/app.js.