Eat this one! is a mobile app to share cooking specialties with your colleagues or classmates at lunch time.
This repository includes:
- An ExpressJS REST API backed by MongoDB
- An AngularJS frontend compiled to Android and iOS apps using cordova
- Grunt tasks for development, testing and deployment.
git clone git://github.com/eat-this-one/eat-this-one.git
cd eat-this-one
npm install -g grunt-cli
npm install -g bower
npm install -g cordova
npm install -g mocha
npm install -g ios-deploy
You only need ios-deploy package if you are interested in using the iOS emulator.
Follow the normal procedure to install the Android SDK; Android Studio is not required. http://developer.android.com/sdk/index.html
Also http://developer.android.com/google/gcm/gs.html for Google Cloud Messaging.
Follow the normal procedure http://cordova.apache.org/docs/en/4.0.0/guide_platforms_ios_index.md.html#iOS%20Platform%20Guide
// Install node dependencies including the local grunt.
npm install
// Depending on whether you want to test using an android device or an ios device.
grunt install:android
grunt install:ios
This will install all dependencies, create the cordova project adding the specified platform and build the current codebase.
Later on you can use grunt update to update the project dependencies.
- Note that, if you want to run the app in your mobile, you can set your IP or hostname in config/frontend.js.
- (Android) You may need to install previous android sdk APIs as cordova is not always using the latest version
- If it is the case, run android sdk and select the required versions
grunt
The default task is an alias of grunt dev task which starts the backend server and watches for codebase changes:
- Runs JSHint and restarts the backend server if required
- Runs JSHint, minifies and concatenates frontend JS files
- Runs CSSLint and compiles less to CSS and minifies it
- Compiles Jade templates to HTML files
- Runs tests if you modify them
http://localhost:8000
http://localhost:3000
As commented above, the hostname or the IP might be better than localhost to test in mobile.
grunt run:android:emulator
grunt run:ios:emulator
This is basically running cordova emulate android and cordova emulate ios in dist/app directory.
grunt run:android:device
It starts the adb server, installs the current build and outputs the device log.
In case you have problems accessing the backend from the mobile http://developer.android.com/tools/devices/emulator.html#networkaddresses
- Start XCode
- Set up your development team & register your testing device
- For more info: https://cordova.apache.org/docs/en/4.0.0/guide_platforms_ios_index.md.html#iOS%20Platform%20Guide
grunt --help
npm test
This runs all backend tests (mocha). There are frontend unit tests and e2e tests (protractor) they run automatically when editing test files.
-
Backend app (JS - Node)
- Models models/*.js
- Routes routes/*.js
- Other modules lib/*.js
-
Frontend app (JS - AngularJS)
- Controllers public/javascripts/controllers/*.js
- AngularJS directives public/javascripts/directives/*.js
- AngularJS services
- If they make use of cordova plugins
- Otherwise
-
Styles (CSS) public/stylesheet/*.less
-
Views (HTML) public/views/*.jade
- Frontend
- AngularJS - https://angularjs.org/
- Karma - http://karma-runner.github.io/
- Grunt - http://gruntjs.com/
- Cordova - https://cordova.apache.org/
- Jade - http://jade-lang.com/
- Less - http://lesscss.org/
- Bower - http://bower.io/
- JQuery - https://jquery.com/
- Bootstrap - http://getbootstrap.com/css/
- Glyphicons - http://glyphicons.com/
- Backend
- NodeJS - https://nodejs.org/
- ExpressJS - http://expressjs.com/
- MongoDB - https://www.mongodb.org/
- Mongoose - http://mongoosejs.com/
- Dokku - https://github.com/progrium/dokku
- And other third party code listed in: