Page Contents

Home > @loopback/rest-crud

rest-crud package

@loopback/rest-crud

Functions

| Function | Description | | — | — | | defineCrudRepositoryClass(entityClass) | Create (define) a repository class for the given model.Example usage:

const ProductRepository = defineCrudRepositoryClass(Product);

| | defineCrudRestController(modelCtor, options) | Create (define) a CRUD Controller class for the given model.Example usage:

const ProductController = defineCrudRestController<
Product,
typeof Product.prototype.id,
'id'
>(Product, {basePath: '/products'});

inject('repositories.ProductRepository')(
 ProductController,
  undefined,
  0,
);

app.controller(ProductController);

|

Interfaces

Interface Description
CrudRestController This interface describes prototype members of the controller class returned by defineCrudRestController.
CrudRestControllerCtor Constructor of the controller class returned by defineCrudRestController.
CrudRestControllerOptions Options to configure different aspects of a CRUD REST Controller.
RepositoryClass