Arrow Builder API Development with Cloud9

11 Flares 11 Flares ×

The Arrow Builder API development flow is to develop, run and test your APIs on your local machine using your favorite text editor and the command line. When your API is ready for deployment, you then publish your Arrow project to the Appcelerator cloud (Public, VPC or on-prem).

Cloud9 combines a powerful online code editor with a full Ubuntu workspace in the cloud. By selecting their Node stack during setup, you can create a cloud-based Arrow Builder development environment in just a few minutes.

Once the Cloud9 environment is running, simply install Arrow Builder according to the Arrow Builder Getting Started Guide and start developing APIs in the cloud using only your browser. There is no need to install any software or dependencies on your machine.

This blog post walks you through the steps of this setup, including installing MySQL and MyPHPAdmin:

  1. Setup a Node.js environment in Cloud9
  2. Install Appcelerator command line tools in your Cloud9 environment
  3. Develop your Arrow app
  4. Run your Arrow app and connect to your APIs
  5. Add MySQL and PHPMyAdmin

Setup a Node.js environment in Cloud9

  1. Open your browser and create an account on Cloud9 at https://c9.io. The free tier is sufficient for most situations.

  2. Create a new Workspace (plus sign on grey box below)

  3. Enter your Workspace name and Description and select the Node.js Template and click the Create workspace button

    You should then see your workspace

    Note that my Cloud9 workspace name above is c9arrowdev

Install Appcelerator command line tools in your Cloud9 environment

  1. Refer to the Arrow Builder Getting Started Guide for setting up Arrow

  2. In the Cloud9 IDE at the bottom in the bash terminal enter the following commands

    
      npm install appcelerator -g
      appc setup
      

    as follows:

  3. Use your Appcelerator credentials to login

Develop your Arrow app

  1. In the Cloud9 IDE Workspace panel, toggle the Show Home in Favorites optionally

    and see the following:

  2. Either using the Cloud9 IDE bash shell or through the workspace panel, create an Arrow workspace and in the shell change directory to your workspace directory

    Note that my Arrow workspace name above is ~/ArrowWorkspace

  3. Create your Arrow project as you would normally from the bash shell

    Note that my Arrow project name above is ~/ArrowWorkspace/c9arrowtestapp

Run your Arrow app and connect to your APIs

  1. Run your Arrow project using:

    
      appc run
      

    and insure that your Arrow app is running:

  2. You can access the Arrow Admin Console via the following URL:

    
      https://projectname-username.c9.io/arrow/index.html
      

    Note that the project name is not your Arrow project name but your Cloud9 Workspace name c9arrowdev in my example: https://c9arrowdev-lbrenman.c9users.io/arrow/index.html

    687474703a2f2f692e696d6775722e636f6d2f67387876647a4f2e706e67
  3. Since our project was initially setup as public the APIs are accessible by the following URL format:

    
      https://projectname-username.c9users.io/api/apiname
      

    For example, my API is accessible using the following URL: https://c9arrowdev-lbrenman.c9users.io/api/account

  4. If you cannot access your API, it is possible that your workspace was initially setup as private. If so, then you need to make your workspace application public by clicking on the share button in the Cloud9 IDE in the top right hand corner and make the application public by checking the checkbox as follows:

Add MySQL and PHPMyAdmin

Cloud9 also supports installing MySQL and installing PHPMyAdmin in your workspace. If you install PHPMyAdmin it will run on port 8080, which is Arrow’s default port. In order to work around this run Arrow on port 8081 or 8082 as Cloud9 only supports these three ports.


appc run --port 8081

The Arrow MySQL connector configuration can use 'localhost' for your host property and 'c9' as the Database name as follows:


module.exports = {
	connectors: {
		'appc.mysql': {
			connectionPooling: true,
			connectionLimit: 10,

			host: 'localhost',
			port: 3306,
			database: 'c9',
			user: 'lbrenman',
			password: '',

			generateModelsFromSchema: true,
			modelAutogen: true

		}
	}
};

Note that the Cloud9 MySQL database password is blank by default

Make sure your MySQL database is running by using the following Cloud9 MySQL script:


mysql-ctl start

Other useful Cloud9 MySQL scripts:


mysql-ctl stop
mysql-ctl status

To run PHPMyAdmin enter the following URL in your browser:


https://c9arrowdev-lbrenman.c9users.io/phpmyadmin

If it does not run, try typing the following in the Cloud9 IDE shell:


phpmyadmin-ctl install

Also, with Arrow running on 8081 (or 8082) you will need to specify the port number in your admin console and API calls as follows:

Admin console:


https://c9arrowdev-lbrenman.c9users.io:8081/arrow/index.html

API call:


https://c9arrowdev-lbrenman.c9users.io:8081/api/appc.mysql/table1
11 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 11 Email -- 11 Flares ×

1 Comment

  1. John

    Thanks Leor, great blog, worked perfectly.

Comments are closed.

computer and tablet showing Appcelerator software
Start free, grow from there.
11 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 11 Email -- 11 Flares ×