Mobile web app template bases on web app template: Mobile web application structure template (layout), starting point for backbone + requirejs + jQuery Mobile compiled by nodejs and running on any web server or phonegap environment :-)
- http://mwatpl-hoatle.dotcloud.com/
- http://mwatpl.herokuapp.com
- http://mwatpl.jit.su/ (dev mod)
- http://mwatpl.ap01.aws.af.cm/ (dev mode)
- http://mwatpl.nodester.com/ (dev mode)
See the base web app template at: https://github.com/hoatle/webapp-template
- take advantage of convention over configuration.
- any controller should be placed on 'controller' directory and extends 'controller/Controller', should be named with affix: 'Controller'.
- any view should be placed on 'view' directory and extends 'view/BaseView', should be named with affix: 'View'.
- By default, application uses hash value for router to dispatch to accordingly controller by pattern: /:controller/:action/*params.
-
Make sure to have latest node installed (with version as 0.6.x and above)
-
Make sure to have 'make'
-
You must run this command first to have node modules installed:
make
ormake resolve
-
Check style with jshint:
make check-style
-
Test the application:
make test
-
Run the application on development mode:
make run-dev
-
Run the application on development mode with remote debug:
make run-dev-debug
. See notice on section: Remote debug the application withmake run-dev-debug
below. -
Run this application on production mode:
make run-prod
-
Access application: http://localhost:8080
-
Access browser tests: http://localhost:8080/browser (only on development mode)
-
Package the production application:
make package
-
Clean the production application build:
make clean
-
As the application uses 'node-supervisor' for hot-reloading, we need to have enable remote debug for node-supervisor. Follows the steps here to have node-debug: http://stackoverflow.com/questions/6468015/run-node-js-application-in-debug-with-supervisor
-
Then
make run-dev-debug
-
see more: https://groups.google.com/forum/?fromgroups#!topic/nodejs/qTlGXNYIy1U petruisfan/node-supervisor#50
- There are 2 directories (ios, android) for wrap the web app into native app.
- Make sure to get phone gap environment and you could create, build, emulate the project on this page: http://docs.phonegap.com/en/2.2.0/guide_command-line_index.md.html
make resolve
, thenmake install
to build the web app project intopublic
directory.- Make symbolic link of
ios/www
andandroid/assets/www
topublic
directory - To build android app, make sure to update the sdk with this command:
android update project -p android/
to generate android/local.properties file - To package the native app, go to ios/cordova or android/cordova and use commands:
debug
,emulate
to see the result.
- clean
- resolve (dependencies resolver)
- check-style (check-style-common, check-style-vsf)
- test (test-common-unit, test-vsf-unit)
- package
- install
- run-dev
- run-prod
- run (as same as run-prod)
- deploy
There are built-in configurations for heroku and dotcloud. Just push this repo and it will be deployed.
- I get this error below when running
make run
,make run-dev
ormake run
:
make run-prod cp -rf webapp public ./node_modules/.bin/r.js -o prod.build.js make: ./node_modules/.bin/r.js: Command not found make: *** [install] Error 127
=> The node modules are not installed. You need to run: make resolve
first. resolve
target can not make it into make run
as it will involve npm install
and heroku does not allow ```npm`` (?) on deployment. The error is something like this:
2012-06-18T19:26:18+00:00 heroku[web.1]: State changed from crashed to created 2012-06-18T19:26:18+00:00 heroku[web.1]: State changed from created to starting 2012-06-18T19:26:20+00:00 heroku[web.1]: Starting process with command `make run` 2012-06-18T19:26:20+00:00 heroku[slugc]: Slug compilation finished 2012-06-18T19:26:20+00:00 app[web.1]: rm -rf public 2012-06-18T19:26:20+00:00 app[web.1]: npm install 2012-06-18T19:26:20+00:00 app[web.1]: make: npm: Command not found 2012-06-18T19:26:20+00:00 app[web.1]: make: *** [resolve] Error 12
- I get this error below when running the command:
make run-prod
:
./node_modules/.bin/r.js -o prod.build.js ./node_modules/.bin/r.js: 1: /bin: Permission denied
=> Please make sure you have the project under a directory that you have write permission on files.
- I get error below when running the command:
make run
,make run-dev
ormake run-prod
:
Error: listen EADDRINUSE at errnoException (net.js:670:11) at Array.0 (net.js:771:26) at EventEmitter._tickCallback (node.js:190:38)
=> You need to change the default port (8080) on server.js to another not used port and it should work.