Initial Version. Support both AfbDaemon & Backend Mock server.
[src/app-framework-demo.git] / afb-client / README.md
1
2 ## Installation
3
4 Install HTML5 development toolchain on your host
5
6 1. Check out this repository
7    git clone https://github.com/iotbzh/afb-client-sample.git
8
9 2) Install NodeJs [not used on target] 
10     zypper install nodejs
11     yum install nodejs
12
13 3) Install building tools [bower, gulp, ....]
14    npm install # this install all development tool chain dependencies
15    sudo npm install --global gulp  # this is not mandatory but it will make your live simpler
16
17 4. For livereload functionality [automatic refresh of HTML/CSS]
18    install [livereload Chrome extension](https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei)
19
20
21 ### Overload ./etc/Defaults.js with '.noderc.js'
22     var config= {
23         APPNAME : 'AFBclient',   // AppName is use as main Angular Module name
24         FRONTEND: "Frontend",    // HTML5 frontend  [no leading ./]
25         BACKEND : "Backend",     // NodeJS Rest API [no leading ./]
26         URLBASE : '/opa/',       // HTML basedir when running in production [should end with a /]
27         APIBASE : '/api/',       // Api url base dir [should end with a /]
28         DEBUG   : 4001,          // Node Debug Port [for mock API debug only]
29         DBG_LVL : 5,             // Debug Trace Level 0=no trace.
30     };
31     module.exports = config;
32
33     WARNING: in current version Frontend/services/ConfigApp.js is not updated automatically
34     you should make sure than your backend config fit with your frontend config.
35     Note: FCS version should have ConfigApp.js configurated automatically from GULP, but this is for "tomorrow"
36
37 ### Build project
38     gulp help
39     gulp build-app-dev
40     gulp watch-dev 
41     http://localhost:3001/opa  /* debug mock api base on Backend/RestApi */
42
43 ### Test with Application server binder  [you may safely run gulp 'watch-dev' + 'afb-daemon' simultaneously]
44     export MYWORKSPACE=$HOME/Workspace
45     $MYWORKSPACE/afb-daemon/build/afb-daemon --port=1234 --verbose --token=123456789 --rootdir=$MYWORKSPACE/afb-client/dist.dev
46     http://localhost:1234/opa
47
48     Note: 
49       - do not forget "/opa" that should match with your config.URLBASE
50       - if you change --token=xxxx do not forget to update ./Frontend/pages/HomeModules.js
51       - Force HTML/OPA reload with F5 after each HTML5/OPA update or new pages may not be loaded. 
52       - When reloading HTML/OPA with F5 do not forget that your initial token wont be accepted anymore. You should either restart to clean existing session or cleanup AJB_session cookie.
53
54 ### Move to Target
55     cd $MYWORKSPACE/afb-client
56     gulp build-app-prod
57     scp -r ./dist.pro/* user@mytarget:/rootdir/apfDaemon
58
59     /AppClient
60     |
61     |---- package.json
62     |---- bower.json
63     |---- gulpfile.js
64     |---- .noderc.js  [Warning: contains private keys should not uploaded in Github]
65     |
66     |---- /Frontend
67     |     |
68     |     |---- index.html
69     |     |---- app.js
70     |     |
71     |     |---- /styles
72     |     |     |
73     |     |     |---- _settings.scss
74     |     |     |---- app.scss
75     |     |
76     |     |---- /Widgets
77     |     |     |
78     |     |     |--- Widget-1
79     |     |     |...
80     |     |
81     |     |-----/Pages
82     |           |--- Home-Page
83     |           |... 
84     |
85     |
86     |---- /Backend
87     |     |-- server.js     // launcher
88     |     |----/ models     // mogoose database schemas
89     |     |----/ providers  // authentication services
90     |     |----/ restapis   // application APIs
91     |
92     |---- (/dist.dev)
93     |---- (/dist.prod)
94
95