
LoopBack is a highly extensible, open-source Node.js framework based on Express that enables you to quickly create APIs and microservices composed from backend systems such as databases and SOAP or REST services.
The diagram below demonstrates how LoopBack serves as a composition bridge between incoming requests and outgoing integrations. It also shows the different personas who are interested in various capabilities provided by LoopBack.
The LoopBack 4 CLI is a command-line interface that scaffolds a project or an extension by generating the basic code. The CLI provides the fastest way to get started with a LoopBack 4 project that adheres to best practices.
A major part of software engineering is building components that not only have well-defined and consistent APIs, but are also reusable. Components that are capable of working on the data of today as well as the data of tomorrow will give you the most flexible capabilities for building up large software systems.
In languages like C# and Java, one of the main tools in the toolbox for creating reusable components is generics, that is, being able to create a component that can work over a variety of types rather than a single one. This allows users to consume these components and use their own types.
In this lecture, I will teach you how to install and setup typescript with Node.js
There are two main ways to get the TypeScript tools:
Via npm (the Node.js package manager)
By installing TypeScript’s Visual Studio plugins
For NPM users:
> npm install -g typescript
You have to create the .ts file and run the tsc and typescript file
The primary reason you create a generic function is because you have some code that meets two criteria:
It's a function or class that will work with a variety of data types
The function or class uses that data type in several places
You have other options: When you have code that works with a variety of data types, you could write one version of the function for each data type, but that's a lot of work and a maintenance nightmare. You could also write one function and have it use the any keyword for its data types, but that would mean abandoning type safety.
Provided that the data types involved are used in several places in your code, a generic function or class is a better solution than your other options: generic functions let you write one version of your code and ensure that the code consistently uses data types (and then, of course, let the developer specify the data type when calling the function/instantiating the class).
In the above example, the type variable T is specified with the function in the angle brackets getArray<T>. The type variable T is also used to specify the type of the arguments and the return value. This means that the data type which will be specified at the time of a function call, will also be the data type of the arguments and of the return value.
In this lecture I will teach how you can create generic function to accept multiple type variables. You can also create a generic function with multiple Type variables
In this lecture, I will teach you how to restrict the generic function to specified type.
In this lecture you will learn how to define interfaces to define the object properties and function type
In this lecture, I will teach you how to create Interface to describe the function type
TypeScript supports generic classes. The generic type parameter is specified in angular brackets after the name of the class. A generic class can have genericfields (member variables) or methods.
Decorators are simply functions that modify a class, property, method, or method parameter. The syntax is an “@” symbol followed by a function. The @readonlydecorator is a class decorator; it is passed a reference to the constructor function and returns a new constructor function that extends its behavior.
Each kind of decorator requires a different function signature, as the decorator is provided with different parameters depending on the decorator use. This section will provide several practical examples that can be used as a starting point for your own decorators.
You can make a decorator configurable by converting your decorator function into a decorator factory. A decorator factory is a function that returns a decorator function. The factory can have any number of parameters that can be used in the creation of the decorator.
In this video, we are going to learn about property decorator. A property decorator can only be used to observe that a property of a specific name has been declared for a class. Property decorators ignore any return, underscoring their inability to affect the decorated properties
In this video, you are going to learn about Parameter decorator. A parameter decorator can only be used to observe that a parameter has been declared on a method.
In this lecture, you are going to learn about class decorator. It allows programmers to modify the behaviour of function or class.Decorators allow us to wrap another function in order to extend the behaviour of the wrapped function, without permanently modifying it.
A model describes business domain objects, for example, Customer, Address, and Order. It usually defines a list of properties with name, type, and other constraints.
In this lecture, we will create our first Loopback Model. A model describes business domain objects, for example, Customer, Address, and Order. It usually defines a list of properties with name, type, and other constraints.
Datasources are LoopBack’s way of connecting to various sources of data, such as databases, APIs, message queues and more. A DataSource in LoopBack 4 is a named configuration for a Connector instance that represents data in an external system. The Connector is used by legacy-juggler-bridge to power LoopBack 4 Repositories for Data operations.
The repository pattern is one of the more fundamental differences between LoopBack 3 and 4. In LoopBack 3, you would use the model class definitions themselves to perform CRUD operations. In LoopBack 4, the layer responsible for this has been separated from the definition of the model itself, into the repository layer.
A Repository represents a specialized Service interface that provides strong-typed data access (for example, CRUD) operations of a domain model against the underlying database or service.
In LoopBack 4, controllers handle the request-response lifecycle for your API. Each function on a controller can be addressed individually to handle an incoming request (like a POST request to /todos), to perform business logic, and to return a response.
Controller is a class that implements operations defined by application’s API. It implements an application’s business logic and acts as a bridge between the HTTP/REST API and domain/database models
A Repository represents a specialized Service interface that provides strong-typed data access (for example, CRUD) operations of a domain model against the underlying database or service.
In this video, I am going to show you how can you install Mysql on your machine
In this lecture, we will connect Mysql Datasource with Loopback 4. We will build datasource first, then repository to perform CRUD operations and then controller to implement the Business Logic
In this lecture, you will learn how to set up the id property to auto increment for table. You can set auto increment from Mysql alter table feature
A hasMany relation denotes a one-to-many connection of a model to another model through referential integrity. The referential integrity is enforced by a foreign key constraint on the target model which usually references a primary key on the source mode
A belongsTo relation denotes a many-to-one connection of a model to another model through referential integrity. The referential integrity is enforced by a foreign key constraint on the source model which usually references a primary key on the target model.
A hasOne relation denotes a one-to-one connection of a model to another model through referential integrity. The referential integrity is enforced by a foreign key constraint on the target model which usually references a primary key on the source model and a unique constraint on the same column/key to ensure one-to-one mapping. This relation indicates that each instance of the declaring or source model has exactly one instance of the target model.
In the JSON Web Token (JWT) authentication approach, when the user provides the correct credentials to a login endpoint, the server creates a JWT token and returns it in the response. The token is of type string and consists of 3 parts: the header, the payload, and the signature. Each part is encrypted using a secret, and the parts are separated by a period.
In this video, I will teach you how to create a signup endpoint and user model. We will save the user in the database
In this video, I will teach you how to validate user credentials for Signup. We do not allow user to signup without providing invalid email and invalid password
Dependency injection is a technique whereby one object supplies the dependencies of another object. A "dependency" is an object that can be used, for example as a service. Before we can use methods of other classes, we first need to create the object of that class (i.e. class A needs to create an instance of class B). Dependency Injection is a set of software design principles and patterns that enables you to develop loosely coupled code.
In this lecture, You will learn how to implement dependency injection in Loopback 4. You will learn how to bind value to Loopback 4 context object. Binding represents the items in context object. Binding represents items within a Context instance. A binding connects its value to a unique key as the address to access the entry in a context.
In this lecture, we are going to create the Login route with Loopback 4 and its api specification. When user will run the application he will be able to see the login route and its input parameters
In this video, I will show you how to find user on the based on email from Database table. We will also learn about how to verify user password by using bcrypt package.
In this video, you will learn how to create json web token by using jsonwebtoken package. There is a sign method I will use it to create a token.
Binding represents items within a Context instance. A binding connects its value to a unique key as the address to access the entry in a context.
Attributes of a binding
A binding typically has the following attributes:
key: Each binding has a key to uniquely identify itself within the context
scope: The scope controls how the binding value is created and cached within the context
tags: Tags are names or name/value pairs to describe or annotate a binding
value: Each binding must be configured with a type of value provider so that it be resolved to a constant or calculated value
Loopback provides authentication strategy. We have to implement Authentication interface that provides authenticate method. We will create JWT strategy, extract token and verify token
Loopback provides the authenticate decorator. I will show you how to use authenticate decorator to protect routes in controller function.
In this lecture, You will learn how to divide your application into multiple roles. You can give access to any specific user/role.
In this video, I will teach you how to give permissions to your user. In this video, we have specified createJob permission to our admin. Only admin can access this route
In this video, I will teach you how verify user permissions in interceptor. If you have multiple roles in application. I will teach you how to verify their permissions in interceptor.
In this lecture, I will teach you how to connect Loopback 4 application with MongoDB database.
In this lecture, I will show you how can you write test cases for your loopback 4 application. You will learn about integrating, unit and acceptance test in Loopback 4
LoopBack is a highly-extensible, open-source Node.js framework that enables you to create dynamic end-to-end REST APIs with little or no coding. LoopBack 4 is the next step in the evolution of LoopBack. You can build Amazing APIs with Modern NodeJs, Typescript, Mysql and MongoDB.
Why Loopback 4:
A brand new LoopBack core to deliver great extensibility and flexibility written in TypeScript/ES2017.
You can Create powerful APIs easily with a new creation experience for defining REST API's and handling API requests/responses.
A new, improved programming model with Dependency Injection and new concepts such as Components, Mixins, Repositories, etc. make this the most extensible version yet.
Using OpenAPI-to-GraphQL, create a GraphQL interface for any REST API
LoopBack is a highly-extensible, open-source Node.js framework that enables you to:
Create dynamic end-to-end REST APIs with little or no coding.
Access data from major relational databases, MongoDB, SOAP and REST APIs.
Incorporate model relationships and access controls for complex APIs.
Separable components for file storage, third-party login, and OAuth 2.0.
What you will learn in this course:
Getting started with Typescript
Getting started with Loopback 4
Basic/Fundamentals of Typescript
Typescript Generics
Typescript Decorators
Typescript Classes
Typescript Interfaces
CRUD(Create, Read, Update, Delete) with Loopback 4
Build RESTFUL API and OpenAPI documentation
Exploring multiple datasources with Loopback 4 like Mysql, MongoDB.
Working with Relationship with Models like One to One, One to Many, Many to One.
Exploring Repositories, Controllers, Dependency Injections, Design Patterns in more depth
Authentication/Authorization in Loopback 4
Using External Component in Loopback 4
Exposing GraphQL API with Loopback 4