What is the architecture of backbone.js in javascript?


The BackboneJS gives a structure to the web applications that allows separating business logic and user interface logic.

The architecture of BackboneJS contains the following modules -

HTTP Request

The HTTP client sends an HTTP request to a server in the form of a request message where web browsers, search engines, etc., acts like HTTP clients. The user requests for a file such as documents, images, etc., using the HTTP request protocol.

Router

It is used for routing the client-side applications and connects them to actions and events using URLs. It is a URL representation of the application's objects. This URL is changed manually by the user. The URL is used by the backbone so that it can understand what application state to be sent or present to the user.

View

BackboneJS views are responsible for how and what to display from our application and they don't contain HTML markup for the application. It specifies an idea behind the presentation of the model's data to the user. Views are used to reflect "what your data model looks like".

Events

Events are the main parts of any application. It binds the user's custom events to an application. They can be mixed into any object and are capable of binding and triggering custom events. You can bind the custom events by using the desired name of your choice.

Model

Models represent business entities with some business logic and business validations. They are mainly used for data storage and business logic. Models can be retrieved from and saved to data storage. A Model takes the HTTP request from the Events passed by the View using the Router and synchronizes the data from the database and sends the response back to the client.

Collection

A Collection is a set of models that binds events when the model has been modified in the collection. The collection contains a list of models that can be processed in the loop and supports sorting and filtering. When creating a collection, we can define what type of model that collection is going to have along with the instance of properties. Any event triggered on a model will also trigger on the collection in the model.

Data Source

It is the connection set up to a database from a server and contains the information which is requested from the client.

Updated on: 27-Nov-2019

100 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements