This is a quickstart application for the mbed-cloud-sdk-javascript package. The goal of this application is to get the user up and running, using the mbed-cloud javascript sdk package and talking to devices through mbed cloud client in under 15 min. The quickstart webapp is meant to be paired with mbed cloud client.
You need to have Node.js and npm installed.
To check if you have them installed, open a terminal or command prompt and run the following commands:
node --version
npm --version
- A mbed cloud portal account and have generated an API token
- A endpoint running the mbed cloud client example
- Install the required packages
npm install
Before running the app, you need to set some config options. This is done through environment variables, by modifying the app directly, or by input arguments as shown in the Input Arguments section.
The following variables are available to be configured:
- MBED_CLOUD_API_KEY - (required) Set this to your API Key you created in mbed Cloud. If you do not have an API Key, see the section Creating an Access Key
- PORT - Set this to override the default port for the app. The default port is 8080.
- MBED_CLOUD_HOST - Set this to change the Mbed Cloud server location
The application has the following code which can be modified:
var accessKey = process.env.MBED_CLOUD_API_KEY || "<access_key>";
var port = process.env.PORT || 8080;
var apiHost = process.env.MBED_CLOUD_HOST || "https://api.mbedcloud.com";
You can now run the app by using the following command:
node app.js
You should receive the following output:
mbed Cloud Quickstart listening at http://localhost:8080
Copy and paste the printed URL into your browser and you should see a page listing all of your connected mbed Clients.
The following input arguments are supported:
--uploadManifest
- Allows you to upload a .JSON
file containing manifest .pem
, .der
, and .json
files from the UI instead of generating new credentials
--apiKey=<MBED_CLOUD_API_KEY>
- Overrides or replaces the environment variable for MBED_CLOUD_API_KEY
--host=<MBED_CLOUD_HOST>
- Overrides or replaces the environment variable for MBED_CLOUD_HOST
- copy your
id_rsa
key file to project folder docker build -t webapp-node .
docker run -p 8080:8080 webapp-node --apiKey=ACCESS_KEY