LoopBack 4 Todo Application Tutorial - Adding legacy juggler
Page Contents

Adding Legacy Juggler

The Legacy Juggler is a “bridge” between the existing loopback-datasource-juggler and the new LoopBack 4 architecture. It provides the capabilities required to access persistence layers/APIs, and perform CRUD operations on those sources of data.

It also provides many of the functions and interfaces we’ll require for setting up our new LoopBack application, which is why we’re starting here.

Now that you have your setup, it’s time to modify it to add in @loopback/repository. Install this dependency by running npm i --save @loopback/repository.

Next, modify src/application.ts to change the base class of your app to use the RepositoryMixin:


import {ApplicationConfig} from '@loopback/core';
import {RestApplication} from '@loopback/rest';
import {MySequence} from './sequence';

/* tslint:disable:no-unused-variable */
// Binding and Booter imports are required to infer types for BootMixin!
import {BootMixin, Booter, Binding} from '@loopback/boot';

// juggler imports are required to infer types for RepositoryMixin!
import {
} from '@loopback/repository';
/* tslint:enable:no-unused-variable */

export class TodoListApplication extends BootMixin(
) {
  constructor(options?: ApplicationConfig) {

    // Set up the custom sequence

    this.projectRoot = __dirname;
    // Customize @loopback/boot Booter Conventions here
    this.bootOptions = {
      controllers: {
        // Customize ControllerBooter Conventions here
        dirs: ['controllers'],
        extensions: ['.controller.js'],
        nested: true,

Once you’re ready, we’ll move on to the Add your Todo model section.

For more information on the Legacy Juggler, check out the @loopback/repository package or see the Repositories section of our docs.

Previous step: Scaffolding your application

Next step: Add your Todo model