0ed9d45bc3b950b4dde22a234792f71c8b417820
[src/app-framework-demo.git] / afm-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/afm-client.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 ./app/etc/AppDefaults.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   : 5003,          // 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/AppConfig.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 AppConfig.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:4003/opa  /* debug mock api base on Backend/RestApi */
42
43 ### Test with Application server binder
44
45     # Start AppFramework Binder
46         export MYWORKSPACE=$HOME/Workspace
47         $MYWORKSPACE/afb-daemon/build/afb-daemon --port=1234 --verbose --token=123456789 --rootdir=$MYWORKSPACE/afm-client/dist.dev
48
49     Point your browser onto: http://localhost:1234/opa
50
51     Note: 
52       - do not forget '/opa' that should match with your config.URLBASE
53       - if you change --token=xxxx do not forget to update ./Frontend/pages/HomeModules.js
54       - Force HTML/OPA reload with F5 after each HTML5/OPA update or new pages may not be loaded. 
55       - 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 afb-session cookie.
56
57 ### Move to Target
58     cd $MYWORKSPACE/afm-client
59     gulp build-app-prod
60     scp -r ./dist.prod/* user@mytarget:/rootdir/apfDaemon
61
62     /AppClient
63     |
64     |---- package.json
65     |---- bower.json
66     |---- gulpfile.js
67     |---- .noderc.js  [Warning: contains private keys should not uploaded in Github]
68     |
69     |---- /Frontend
70     |     |
71     |     |---- index.html
72     |     |---- app.js
73     |     |
74     |     |---- /styles
75     |     |     |
76     |     |     |---- _settings.scss
77     |     |     |---- app.scss
78     |     |
79     |     |---- /Widgets
80     |     |     |
81     |     |     |--- Widget-1
82     |     |     |...
83     |     |
84     |     |-----/Pages
85     |           |--- Home-Page
86     |           |... 
87     |
88     |
89     |---- /Backend
90     |     |-- server.js     // launcher
91     |     |----/ models     // mogoose database schemas
92     |     |----/ providers  // authentication services
93     |     |----/ restapis   // application APIs
94     |
95     |---- (/dist.dev)
96     |---- (/dist.prod)
97
98