在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):heroku/mobile-template1开源软件地址(OpenSource Url):https://github.com/heroku/mobile-template1开源编程语言(OpenSource Language):JavaScript 79.9%开源软件介绍(OpenSource Introduction):
Heroku template mobile app |
component | folder |
---|---|
client app | client |
..app code | client/js |
..html templates | client/templates |
..ionic/angular frameworks | client/lib |
express app | server.js, server/* |
..db migrations | server/migrations |
..question list | server/load_question.js |
admin app | admin |
The front-end app is an AngularJS single page application. Thus all the HTML and Javascripted are loaded and run in a single WebView control on the phone. Different screens and navigation are all drawn in the browser DOM.
Angular
As an option, the app can be configured so that each person who registers to play is recorded as a Lead record in Salesforce. This template shows how to access the Force.com API to exchange data with a Salesforce account. See FORCE_README for full instructions.
Install node-debug
to use the Chrome debugger with Node.js:
$ npm install node-debug
And to use, just run with node-debugger
. After the Chrome debugger opens, make sure to click Run
so the server starts:
$ node-debug server.js
To bundle your client app as a native mobile app, you can use the Cordova tool. Note that to build a native app you will need the corresponding native build tools. So for iOS apps you will need Xcode installed, and for Android apps you will need to have the Android SDK installed.
Install Cordova:
$ sudo npm install -g cordova
Install an application simulator:
$ sudo npm install -g ios-sim
Initialize the wrapper:
$ mkdir wrapper
$ cd wrapper
$ cordova create . QuizLive
$ rm -rf www
$ ln -s ../client www
Now add one or more platform targets:
$ cordova platform add ios
$ cordova platform add android
Now build the native app:
$ cordova compile ios
And run in the emulator:
$ cordova run --emulator
The Ajax calls used in the Angular client are written using simple relative paths. This means that they automatically use the host
value inferred from the domain which served the client JS files. This all works properly when the client app is served from a web server.
However, when you package the client files into the Cordova wrapper, then they are provided to the mobile device from the local filesystem, rather than being served from the web. As a result there is no domain
to tell the Ajax calls where to go. To correct this, you need to specify your web domain explicitly in all client Ajax calls, such as the login call:
https://github.com/heroku/mobile-template1/blob/master/client/js/services.js#L80
Scott Persinger [email protected]
See LICENSE. This code is available under the MIT license.
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论