The repository pattern is one of the more fundamental differences betweenLoopBack 3 and 4. In LoopBack 3, you would use the model class definitionsthemselves to perform CRUD operations. In LoopBack 4, the layer responsible forthis has been separated from the definition of the model itself, into therepository layer.

    A represents a specialized Service interface that providesstrong-typed data access (for example, CRUD) operations of a domain modelagainst the underlying database or service.

    From inside the project folder, run the lb4 repository command to create arepository for your to-do model using the datasource from the previousstep. The db datasource shows up by its class name DbDataSource from thelist of available datasources.

    The file makes exporting artifacts central and alsoeasier to import.

    Now we can expose the Todo API through the.

    Previous step: Add a datasource