rs-sample-node-a2p3
Sample Resource Server for A2P3
##Prerequsites
-
git
-
node 0.8.x or later
-
Facebook account
####Optional
- AWS account
##Install and Setup
-
git clone git://github.com/dickhardt/rs-sample-node-a2p3.git
-
cd rs-sample-node-a2p3
-
npm install
-
npm run config
-
Register if need be at setup.a2p3.net and create a CLI Agent and save the device and token parameters
-
Edit config.json and insert the
device
andtoken
parameters and setappID
to your machine name (it must not conflict with any Apps already registered at the Registrar) -
npm run register
to create the vault.json file -
npm start
will start the server locally
####config.json and vault.json See node-a2p3 for details
Deployment to AWS Elastic Beanstalk
-
Decide what hostname you will be using for you Resource Server. Set the
appID
in config.json and rerunnpm run register
to generate a new vault.json if it is different. -
Add the generated vault.json and config.json files to the local repo so that they will be deployed to AWS:
git add -f vault.json git add -f config.json git commit -a -m"add in vault and config"
-
Browse to AWS and register or login.
-
Get your Access Key ID and Secret Access Key from Security Credentials
-
Install and setup the eb CLI tools.
-
eb init
providing your Access Key ID and Secret Access Key and accept all defaults. Note the sample does not use an external Database, you will need to modify the sample to use one. -
eb start
will deply and start your application -
Configure your DNS or to point your host name to the host at elasticbeanstalk.com where your RS is deployed.
When you make changes, git aws.push
will upload your local commits to AWS (remember to git commit -a -m"<commit description here>"
)
Additional documetion on running Node on Elastic Beanstalk
##Testing
npm test
will run the tests
NOTE: see the comments in test/test.js for values you will need to modify to run a test
The server must be running to be tested, and the DB needs to be empty. Stopping and restarting the server will clear the in-memory DB.
##Database This sample stores all of its data in an large JSON object. The DB API calls are all have prcoess.nextTick() calls so that it acts async. To have resilient storage, rewrite db_dev.js to expose the same API but work with the database of your choice.
Related
A2P3_specs Specifications and POC documentation
A2P3 POC Server implementation source (node.js)
A2P3_agent POC mobile agent (PhoneGap)
A2P3_bank POC mobile bank app (PhoneGap)
node-a2p3 node.js npm module for A2P3 applications
sample-node-a2p3 sample A2P3 application using node-a2p3
License
MIT License
Copyright (c) 2013 Province of British Columbia
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.