Message:

JavaScript (19 posts)

In one of my previous articles, I showed how to develop a custom Alexa skill using an example of a Trip Planner app  (How To Build A Dialogue Custom Alexa Skill Using JavaScript (Without Lambda). In this article I will show you a more complex example of the interaction between Alexa and the user. Today will build a  “Guess My Number” game where Alexa (or technically the skill) thinks of a number and the user tries to guess it while the skills suggests whether it is lower or higher. Here’s a sample dialogue a user may have with Alexa once you implement the skill:
guess my number example1 153x300 - Developing a Custom Skill for an Alexa Game guess my number example2 152x300 - Developing a Custom Skill for an Alexa Game

Continue reading

What does  “mobile-to-web cross login with a QR code” mean ? It is one of the approaches for the two-factor authentication. Suppose that a user is already authenticated in your application (in my example it would be an android app) and the user wants to use it’s actual session to perform an automatic authentication in another application (in my case it’s a web app). There are several examples of popular apps which use this approach. For example, to login into a web session with WhatsАpp, you must login on your phone and then scan a QR code in the web interface.login with qr1 - How to implement mobile-to-web cross login using a QR code

Continue reading

Backendless 5 is now released (hooray!) and it offers a bunch of new powerful capabilities. One of them is support for development of custom Amazon Alexa Skills. In this post I am going to demonstrate how easy it is to create a custom skill using JavaScript. You will learn how to control the dialogue flow between the user and Alexa using Backendless and custom Cloud Code.

An example we will build a trip planner skill, albeit a trivialized version of it, which will gather from the user the departure date, the departure and arrival cities. The collected information can be used to search available fares, hotels and make any other necessary arrangements.

What You Will Need

Continue reading

Today we will talk about how to monitor client’s Real-Time Connections in your Angular application. This tutorial continues the guide on how to build Angular apps with Backendless. It is recommended to check out the previous article in this series before you continue for the reason that we will use the application from the previous post as the starting point for this tutorial. Alternatively, if you just want to start working with the it right away, just download the source code from this GitHub commit.

In many cases we want to see how many application users are online or offline, for example, it might be useful in a chat application. For the demo purposes,  in our application we will add a simple counter for count all connected clients. As we explore adding that functionality,  you will meet with Backendless Business Logic, Backendless Counters, Codeless and keep discovering Real-Time features:

image11 - How to monitor Real-Time Connections in an Angular app

Continue reading

Great news, guys! Backendless 5 is now released and it’s time to show you some new features we’ve been working on.  In this article we will talk about how to integrate the Backendless Real-Time Database into your Angular application. Meanwhile, you can check out the previous version of our Angular app in this post. In case you haven’t read the post and don’t have that app  yet, please review the previous article, because we will use that application as a starting point for this tutorial. Or, if you just want to start working with the it right away, just download the source code from this GitHub commit.

ezgif 5 83e7494ea4 - How to use the Backendless Real-Time database in your Angular App

Continue reading

Today we will talk about the integration of Backendless into your AngularJS/TypeScript app. You will create a simple Address Book application where all the application data will be stored in the Backendless mobile backend. The main goal of this article is to provide step-by-step instructions and to show how to create an Angular application with Backendless mBaaS.

BackendlessAngular 10 - How To Create A Web App Using Angular And Backendless

Continue reading

All available APIs for creating, updating and deleting objects in the Backendless database operate on single objects. It means when you need to store multiple objects in the database, each object requires a separate API call. This increases the number of API calls your app makes. While it is great for us (hey, our billing is based on the API calls), it is not that great for your app as it results in longer processing times and substandard user experience. Starting today, with the release of Backendless version 4.5.0 we’re introducing the new APIs which will allow you to create, update or delete multiple objects with a single API call.

Bulk Create

Saving multiple new objects in the database is now as simple as passing an array of objects to the server. The server responds with a collection of objectId values (which, for example, can be used in the createRelation  API). The bulk create API is supported in all SDKs as well as the REST interface.

Bulk Update

To update objects in the database, the API accepts a condition (where clause) which identifies a group of objects. In addition to the condition, the client must also provide an object containing the changes which should be applies to the selected objects.

Bulk Delete

Similar to “Bulk Update”, this API receives a condition which identifies a group of objects to be deleted.

All of the APIs can be extended using custom business logic’s before/after events.

You can find the documentation for these APIs in the developer guides:

This post describes the process of developing an API Service in Backendless with JavaScript. You will learn:

  • how configure your development environment
  • include NPM dependencies
  • run the service in the debug mode and test it using the Backendless console
  • deploy the service to Backendless

The service you will develop in this guide will provide APIs for controlling a LIFX wi-fi enabled light bulb. This very service is used in the article describing how to integrate Amazon Alexa with an IoT device using Backendless. This article references IntelliJ IDEA as the IDE, however, it is not required, you can use any code editor. Make sure to create a Backendless account and create an app in Backendless Cloud (the free tier or the trial option will be plenty to proceed).

Continue reading

Performing a calculation on a group of database objects may be a complex task. For example, to calculate the sum of all orders for a customer would require retrieving all customer’s orders, iterating over them to calculate the mathematical sum of all amounts. This was yesterday! As of Backendless 4.4.0, you can use aggregate functions to calculate the average, sum, maximum and minimum values for a collection of objects without retrieving them from the server. Additionally, the system supports calculating object count for all records in the database or a record subset.

To use an aggregate function, simply request a property in a data retrieval request in the following format (the example below is for calculating the sum for the orderAmount  column):

The returned object includes the sum  property with the calculated value:

The name of the property can be modified by assigning an alias (using %20  to replace the spaces in the URL):

The result contains a value for the property named after the alias:

Grouping Results

Results can be grouped by a column. The column could be either in the same table or a related one. For example, the following request retrieves the sum of all orders grouped by related country:

Unlike the response above, the result for this query includes a collection of objects, each containing the sum for a related country:

It is also possible to apply a filter on the grouped values. This can be done using the having  clause. For example, the request below retrieves only the groups of countries where the total order amount is greater than 10000:

For more information about aggregate functions see the Backendless API documentation:

For anyone developing business logic in JS, we have put together some suggestions for troubleshooting your deployment. The page is added to the product documentation. One of the new features described in the doc is the ability to redirect console.log  messages to Backendless logging. Once your JS code is deployed to production, messages from the console.log  calls will be routed to the log file wit the SERVER_CODE  logging category.

timerlog - Troubleshooting JS business logic

Find us in facebook