HelloTodo is a simple todo list application created with StrongLoop, LoopBack and Bluemix Mobile Services. It serves as a sample app demonstrating how to use the above technologies in order to create a mobile backend, enable authentication and collect monitoring data.
- Overview
- Creating this application
- Deploying HelloTodo application to Bluemix
- Using a MobileFirst Services Boilerplate
- Manually deploying to Bluemix
- Getting setup with Bluemix
- Creating an instance of Mobile Client Access service
- Cloning and deploying HelloTodo app
- Using the HelloTodo application and API
Below video demonstrates how the HelloTodo application was created. It might be instrumental in understanding how does StrongLoop, LoopBack and Mobile Client Access work. If you're just interested in running the app in Bluemix you may skip this video.
There are two ways of running this application - using a MobileFirst Services Boilerplate on Bluemix or cloning the repository and deploying to Bluemix manually.
Start by creating a mobile backend on Bluemix by using the MobileFirst Services Boilerplate
The links in below steps lead to the US_SOUTH Bluemix region. You might want to pick a region closer to you, e.g. UK or SYDNEY.
- Log in into your IBM Bluemix account
- Open Bluemix Catalog https://console.ng.bluemix.net/catalog/
- Find and select the MobileFirst Services Starter under the Boilerplates section
- Select the space you want to add your mobile backend to
- Enter the name and a host for your mobile backend.
- Optionally you can change service plans
- Click CREATE button
As a result of the above steps Bluemix will provision a Node.JS runtime and populate it with a HelloTodo application created using StrongLoop. This application uses LoopBack framework to expose the /api/Items
API which will be used by Web UI. This reposotory contains the source code of that HelloTodo application.
Some of the methods of the above API are protected by Mobile Client Access service, therefore they will be unaccessible from web UI. You will need to use mobile HelloTodo samples to be able to access these APIs. This will be explained later.
Usually it might take couple of minutes for your application to be provisioned and started. Once you're back to your Bluemix Application Dashboard click on an application route found in the top part of a screen.
Once you open the web interface of a HelloTodo app you may continue to the Using the HelloTodo application
and API section of this tutorial below
To manually deploy this application to Bluemix perform the following steps
-
Make sure you have IBM Bluemix account
-
Make sure you have Cloud Foundry CLI tool installed
-
Open terminal and verify that cf tool is available by running
cf --version
-
Setup
cf
tool to work with a Bluemix API server of your choice, for instancecf api https://api.ng.bluemix.net
Use following URLs for other Bluemix regions:
US-SOUTH
https://api.ng.bluemix.net
UNITED KINGDOM
https://api.en-gb.bluemix.net
SYDNEY
https://api.au-syd.bluemix.net
-
Login with your Bluemix credentials and pick your organization and space by running
cf login
-
Make sure you're in a right region, organization and space by running
cf target
-
HelloTodo app requires an instance of a Mobile Client Access service to be bound. Mobile Client Access is a service that provides authentication and monitoring capabilities for your Bluemix apps.
-
Run the following command to create a new instance of Mobile Client Access service if your space.
cf create-service AdvancedMobileAccess Bronze my-MCA-service-instance
You can pick any other name instead of my-MCA-service-instane
-
Run
cf services
command and validate a new service instance was added
-
Clone this repository to your local disk
git clone https://github.com/ibm-bluemix-mobile-services/bms-hellotodo-strongloop
-
Edit
manifest.yml
file. Change thehost
property to some unique value. There might be other applications deployed to Bluemix withhellotodo-with-strongloop
host. If do not change it your deployment might fail. -
Edit
manifest.yml
file and add the services section. Add the Mobile Client Access service instance name created in previous steps. Final result should look like this -
Use
cf push
command to deploy your application to Bluemix, bind it to Mobile Client Access service instance and start it. -
Once deployment completes successfully use
cf apps
command to see the list of available applications and their routes -
Your Bluemix application should be available at
https//{hostname-from-manifest.yml}.mybluemix.net
You will see a HelloTodo web app. Start by following the guided experience steps described in the web UI. Eventually you will try to DELETE a todo item and will discover that this action can only be complete when using the HelloTodo mobile apps samples. This is due to a fact that the mobile backend is by default protected by a Mobile Client Access - a Bluemix service that provides security and monitoring functionality for mobile backends.
You might also want to hit the "View API Reference" button on web UI to see the API specs.
Continue experiencing Bluemix Mobile Services by using one of the following sample applications.