Node.ACS
Appcelerator Custom Cloud Service (Node.ACS) allows users to publish Node.js based services into the cloud. This integration builds on top of the command-line interface, about which you can read more information here:
There are two possible ways of creating a custom cloud project--either a "Standalone" or a "Client/Server" project.
Installing Node.ACS
Install the Node.ACS plugin from http://preview.appcelerator.com (requires Studio 3.0.0 or later).
Node.js 0.8.13 or later is required for Node.ACS development. If you do not have an appropriate version installed, you will be prompted to install Node.
Standalone projects
A standalone project consists of just the Node.ACS code. You might have multiple Titanium Mobile clients talking to a single Node.ACS service.
Creating a new service
-
File > New > Node.ACS Project
-
Give the project a name. You can have a '.' in the middle of the name, just not at the beginning or end.
The process will complete, returning the appID of the service. You'll use this value later, and can find it again by inspecting the package.json file.
Adding additional methods to your service
-
Show your project in the App Explorer or Project Explorer view
-
Right-click on the project and choose New > Node.ACS Method
-
Give the method a name.
The method will be created and added to the main <project_name>.js file.
Publishing your service
-
Show your project in the App Explorer or Project Explorer view
-
Click on the Publish icon in the top of the view
-
Select Deploy App
-
Your application will be deployed. It will give you information about the endpoint URL for the application. By default, the service URL will be http://<app_id>.cloudapp.appcelerator.com, where <app_id> is the generated ID for your application. It may take a few minutes for the application to be available.
-
You could go to the service URL later using Publish > View Node.ACS Service
-
You could publish multiple versions of the application by updating the version string in package.json file and then selecting Publish > Deploy App again.
Unpublishing your service
-
You could unpublish a specific version of the application using Publish > Unpublish Node.ACS Service.
Integrated projects
An integrated project consists of both Titanium Mobile client code and Node.ACS server code in the same project. The client talks to the server and they are run and published together.
Creating a new project
-
File > New > Titanium Project
-
Give the project a name. You can have a '.' in the middle of the name, just not at the beginning or end.
-
Check to "cloud-enable" this application
Creating a new service
-
Show your project in the App Explorer or Project Explorer view
-
Right-click on the project and choose New > Node.ACS Service
-
Give the service a name.
The service will be created under project/acs/server_name directory, and a main <project_name>.js and package.json files should appear.
Adding additional methods to your service
-
Show your project in the App Explorer or Project Explorer view
-
Right-click on the project and choose New > Node.ACS Method
-
Give the method a name.
The method will be created and added to the main <project_name>.js file.
Publishing your service
-
Show your project in the App Explorer or Project Explorer view
-
Click on the Publish icon in the top of the view
-
Select Publish > Node.ACS Service
-
Your application will be deployed. It will give you information about the endpoint URL for the application. By default, the service URL will be http://<app_id>.cloudapp.appcelerator.com, where <app_id> is the generated ID for your application. It may take a few minutes for the application to be available.
-
You could go to the service URL later using Publish > View Node.ACS Service
-
You could publish multiple versions of the application by updating the version string in package.json file and then selecting Publish > Node.ACS Service again.
Unpublishing your service
-
You could unpublish a specific version of the application using Publish > Unpublish Node.ACS Service.
Connecting your application to a service
-
Show your Titanium project in the App Explorer or Project Explorer view
-
Click on Node.ACS > Import Node.ACS Service
-
Select a project from the list of available Node.ACS projects. Remote 3rd-party services are not yet supported.
A persistent reference from the client Titanium project to the server Node.ACS project will be created. Whenever the Node.ACS project's main <project_name>.js file is edited, we'll automatically run "acs compile" and copy the client-side binding JS file generated to each client Titanium project.
Testing your service locally
-
Show your project in the App Explorer or Project Explorer view
-
Click on the Run button and choose Local Node.ACS Server
-
The project is launched and running on a server off of http://localhost
-
To manage and stop the server, open Windows > Show Views > Servers.
By default, the server is running on a randomly assigned local port. To specify the specific port to use:
-
Show your project in the App Explorer or Project Explorer view
-
Click on the Run Configurations... button from the main toolbar and choose the previously run "Local Node.ACS Server - <project_name>" configuration
-
Edit the port setting in the configuration
-
Exit and re-run the server
Updating Node.ACS
Studio will automatically check for Node.ACS package update when it is launched. You could also update it from the command line using
sudo npm update acs -g