Message:

Quick Start Guide for JavaScript

This guide will help you get up and running with Backendless quickly so you can develop JavaScript applications on top of our services. At the end of the guide you will have a configured working environment and a basic project with the code communicating with the Backendless services.

  1. Login to your Backendless account or register to create a new one.
  2. Download JavaScript SDK package from the Backendless SDK Downloads page and unzip it to a temporary folder.
    js-sdk-download
  3. Create a new JavaScript application project or open an existing project (you will find several examples included into the Backendless for JavaScript SDK distribution).
  4. The SDK distribution includes the client-side JS library, which contains the Backendless APIs. You need to include the library into your application. There are two way to import the library (pick 1 or 2):
    1. Copy backendless.js from the libs directory of the SDK distribution to your project ‘libs’ folder. (If your project does not already have a “libs” folder, create one at the root of the project). Add the following line to the <head> element of your index.html file:

      OR
    2. Add the following line to the <head> element of your index.html file:
  5. Create a directory for the javascript files of your app, name the directory js and then create a file for your application inside of the directory called app.js. Finally link it to your index.html just before closing </body> tag:
  6. Get your Backendless application keys for Backendless SDK for JavaScript from the Backendless Console. The keys can be found in the Manage > App Settings section:
  7. Copy/paste the application ID and JavaScript secret key into the code and add the Backendless application initialization code in app.js:
  8. Add the following code to register a user with your app. Instead of michael@backendless.com  used in the code, consider using an email address  where you can check email – your Backendless backend will send out an email welcoming the user to your app.
  9. Run your application by opening the .html file in a browser. A new app user is registered with Backendless. You can verify the registered user in the Data section of the Backendless Console:
  10. In order to experience the Backendless Data Service API declare a new constructor function. Instances of the class can be saved using the Backendless API. The function name is going to be “Comment”, it will also correspond to a table with the same name
  11. Use the code snippet below to store an instance of the “Comment” from the registered user:
  12. Open the html page in a browser, so it runs the code.
  13. Now you can verify in the Backendless Console that the “Comment” data table has been created with the columns corresponding to the properties of the Comment class and it contains the saved instance.

Finally all your code should look like this:

index.html:

app.js:

Enjoy!