Tag Archives: JavaScript

Back to blog home page

New Feature: Facebook Graph API Support

Posted by on Dec 06, 2016

We’re pleased to announce Backand support for the Facebook Graph API. The Graph API gives your application access to user’s Facebook profiles (with their permission, of course). With it, you can retrieve data such as birthdays, friends list and profile photos and enrich the data of your app running on the Backand, backend-as-a-service (BaaS).

Retrieving data from Facebook using the Graph API

To retrieve data from Facebook using the Graph API, get the Facebook user ID after the user signed up to your Backand app. Once you have the Facebook user ID, use the Facebook graph API to retrieve data or perform other actions.

To get the Facebook user ID (FUID) in Backand, follow these steps:

  1. Open Security & Auth >> Security actions menu and Edit “beforeSocialSignup” action
  2. Change the Where Condition to true (bottom of the page)
  3. Uncomment the code that saves the Facebook user id:userInput.fuid = parameters.socialProfile.additionalValues.id;
  4. Save the Action

Next you need to add the fuid field in the users object:

  1. Open the model page under objects menu
  2. Add new Field in the users object named fuid
  3. Click Validate & Update and Ok in the dialog

Now, when a user signs up to your app using Facebook as a social login provider, you will see the users’s FUID in the users object.

Getting Facebook data in Backand code

Once you have the Facebook user ID, use the Graph API to access any available Facebook data.

  1. The FB Graph API docs
  2. You also would need access token of your app, use this FB tool to get it.
  3. More FB tools
  4. For example, to get a user’s friends use the following JavaScript action code:

Getting a Facebook profile image

To get the Facebook profile image you just need to point to the following URL with a correct FUID:

http://graph.facebook.com/{fuid}/picture

or

http://graph.facebook .com/10209560720107355/picture?type=large

You can also review Facebook’s docs on how to use the Graph API.

​Don’t have a Backand backend-as-a-service account? Why not get one now?  Get Free Backand Account.

Back to blog home page

Integrating an AngularJS App on Backand with Amazon S3

Posted by on Oct 30, 2015

Expanding Available Functionality

Amazon Web Services, or AWS, offer a lot of useful functionality for web developers: from hosting, to distributed computing, to data storage, and much more. We at Backand leverage AWS in several ways and in this post we’ll look at Amazon S3, and how you can integrate the object storage service into a Backand-powered application.
Continue reading

Back to blog home page

Using CoffeeScript with AngularJS

Posted by on Sep 09, 2015

JavaScript is an incredibly flexible language, allowing for nearly any imaginable programming style to be used. JavaScript allows you to approach programming from any of a number of paradigms, including procedural programming, object-oriented programming, declarative programming like that used in AngularJS, and even functional programming. However, many newer languages like Ruby, Haskell, and Python have introduced programming idioms that have proven particularly useful as these languages have evolved. Many developers lamented that this kind of functionality was not available in JavaScript, and consigned themselves to sometimes complicated work-arounds. Below we’ll look at CoffeeScript, which allows developers to use many of these new features in a JavaScript-like language which can later be compiled into a form that the application can use.

Continue reading

Back to blog home page

Functional Testing with Mocha & Chai

Posted by on Aug 26, 2015

Full Stack JavaScript Code

In full stack JavaScript development involving JavaScript on either or both the client-side and the server-side, we would like to test function input-output behavior. In its simplest form, function input-output behavior specifies the output of the function in terms of its input.

Continue reading

Back to blog home page

MVVM Deep Dive

Posted by on Jun 24, 2015

One of the key advantages of AngularJS’ implementation of two-way data binding is that it enables a true implementation of the Model-View-ViewModel (MVVM) pattern. The MVVM pattern originated as an architectural approach for Microsoft’s WPF framework, but has since evolved into a more common web-development paradigm driven by the proliferation of JavaScript frameworks. As it is focused on truly separating the user interface from the underlying data and logic, it is in many ways similar to the MVC architecture we have already discussed. However, there are a few crucial differences that make the MVVM architecture a unique selling point of frameworks like AngularJS. Below we’ll look deep into the thought process behind MVVM, and see what AngularJS provides us for implementing this architecture in a web application.

Continue reading

Back to blog home page

Model-View-Controller (MVC) Deep Dive

Posted by on Jun 16, 2015

An Introduction to MVC

The Model-View-Controller (MVC) pattern is a web application architectural pattern that focuses on one thing – separation of concerns. The goal is to separate data handling from display logic, and separate the presentation of the data from its underlying representation and tied-in application logic. MVC is a very common and very popular architectural structure for website design and development. Below we’ll dive deeper into the MVC pattern. We’ll explore each of the components, their intended use, and how they are typically used in a web application. Finally, we’ll tie it all back into AngularJS, and see how we can use the MVC pattern to greatly ease application development.

Continue reading

Back to blog home page

How to Build an Angular App with Server Side Logic

Posted by on May 26, 2015

Overview

Actions are a powerful tool that allow you to perform customized tasks when a number of different types of events occur within your application. They provide a great alternative to server-side custom code, and can add a lot of flexibility to how your application interacts with outside services. Below we’re going to look at the types of actions that Backand offers application developers, and how they can easily be used.

Continue reading

Back to blog home page

Zero Effort Angular App with a Database, RESTful API & Security

Posted by on May 26, 2015

Recently, we at Back& released a tutorial on the Backand Github page that shows off a lot of the features available by default in a Backand-powered application. After completing the tutorial, you’ll have a simple ToDo list application with full support for user and role-based security. Below we’ll discuss each of the features demonstrated in the tutorial, and cover any items remaining that are necessary for a full deployment.

RESTful API Out-of-the-Box

One of the first things we do in the tutorial, after actually creating the application with Backand, is create a new database using our JSON-based schema language. This powerful tool allows you to quickly build a database and the associated tables and objects without having a client installed. More importantly, once the database has been created, Backand automatically creates a RESTful API based on your underlying database schema. This allows you to have immediate access to your database via a series of REST API calls that create, retrieve, update, and delete records at whim. With some simple JavaScript, you can quickly build out a data layer that would take months in a stand-alone project! Furthermore, the moment you make a change to your schema, Backand will detect the change and update the API endpoints accordingly. This automated updating greatly eases the process of migrating database schema changes, and takes some of the load of server programming off your shoulders, allowing you to focus on your application’s functionality.
Security Roles

While the RESTful API is indeed a powerful tool, the main goal of this tutorial is to explore user- and role-based security. Through Backand’s dashboard you are granted a powerful array of tools that you can leverage to secure your underlying application. You can assign user-specific security settings for each object in your app, including everything from table update calls to custom triggers and actions.

However, doing this for every user that signs up for your application would be incredibly tedious. Luckily, Backand provides User Roles that you can assign to the users in your application. Roles set a basic template for interacting with your application’s API, allowing you to restrict all users with that role to only specific actions in your application. These roles can also be overridden at an endpoint level, allowing you to grant roles specific access to resources while still maintaining their general security profile.

After the tutorial has been completed, you will have three roles for your users – administrators who have full control, users who can view all records in the application (but only update or delete those that they create themselves), and read-only users that are only able to view the ToDo items in your application.

Login and Anonymous Access

In addition to security roles, this tutorial will introduce you to the user access functionality available in Backand. You’ll implement a mechanism for inviting users to register for your application, and enable two-step verification for your application’s users, and all of the complexity will be managed by Backand! Furthermore, you’ll learn how to enable anonymous access to your application through a few simple administrative dashboard settings. After the tutorial has been completed, you will have a fully secure application that allows you to invite users to the system, automatically assign them a security role, and even enable anonymous access to your ToDo list should you wish to do so.

Remaining Items

While the tutorial will walk you through the entire application – from inception to completion – there will still be a few tasks remaining before you can show off your new Backand-powered ToDo list app. The first section of the tutorial focuses on setting up a local application development environment, which allows you to develop and run the code on your local machine. However, once you’ve implemented the code and are ready to show it off, you still need to track down a web server to use for deployment. Luckily this web server does not need to be particularly robust, as your application requires zero server-side customization – simply deploy the application code to a publicly-accessible folder and you are set!

Once you’ve published your application on a web server, you have a few more steps remaining in order to fully deploy the application. As a part of the tutorial you set several internal sign-up and authentication URLs that point at your local development instance. Obviously these will no longer function once you have deployed the code! Simply change the appropriate user security settings in your application’s Backand dashboard, and your application will be ready to show the world!

Conclusion

This tutorial gives you a quick look at the power offered by Backand’s back end tools and APIs. You’ll explore creating a database and implementing a RESTful API for that data with zero effort. You’ll customize your application’s security and learn how to restrict users based on role and based on endpoint. You’ll even spend some time working with custom server-side actions that execute on-demand. By the time you have finished the tutorial, you will have implemented a secure ToDo list application with user authentication – and all with minimal effort!

Click here to start the Backand ToDo tutorial. And be sure to sign up for free and start creating your app today.

Back to blog home page

The PROs of AngularJS

Posted by on May 05, 2015

Overview

Building off our infographic on the pros and cons of developing in AngularJS, we felt that some of the points we made deserved a bit of a deeper explanation. In this article we’ll look at the pros of Angular development. We’ll cover the major benefits of working in Angular, diving a bit deeper into the aspects of the framework that may not be immediately obvious.

Continue reading

Back to blog home page

Another Hybrid Framework Battle Begins – Ionic vs Kendo

Posted by on Apr 30, 2015

Overview

In the web development world, there are a number of different frameworks used to varying degrees by developers looking to save time in their application development efforts. These include frameworks like AngularJS, ReactJS, and even just plain JQuery. This division of frameworks has bled into the mobile realm, as JavaScript UI frameworks for mobile development have evolved into robust suites of functionality that make mobile app development quick and relatively painless. Below we’ll look at two different mobile UI frameworks: Kendo and Ionic. We’ll take a look at the ideas underpinning each one, and examine situations in which one or the other will serve best.

Continue reading