@loopback/docs
Version:
Documentation for LoopBack 4
57 lines (42 loc) • 1.89 kB
Markdown
---
lang: en
title: 'API docs: rest-crud'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
editurl: https://github.com/strongloop/loopback-next/tree/master/packages/rest-crud
permalink: /doc/en/lb4/apidocs.rest-crud.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/rest-crud](./rest-crud.md)
## rest-crud package
[@loopback/rest-crud](https://github.com/strongloop/loopback-next/tree/master/packages/rest-crud)
## Functions
| Function | Description |
| --- | --- |
| [defineCrudRepositoryClass(entityClass)](./rest-crud.definecrudrepositoryclass.md) | Create (define) a repository class for the given model.<!-- -->Example usage:
```ts
const ProductRepository = defineCrudRepositoryClass(Product);
```
|
| [defineCrudRestController(modelCtor, options)](./rest-crud.definecrudrestcontroller.md) | Create (define) a CRUD Controller class for the given model.<!-- -->Example usage:
```ts
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](./rest-crud.crudrestcontroller.md) | This interface describes prototype members of the controller class returned by <code>defineCrudRestController</code>. |
| [CrudRestControllerCtor](./rest-crud.crudrestcontrollerctor.md) | Constructor of the controller class returned by <code>defineCrudRestController</code>. |
| [CrudRestControllerOptions](./rest-crud.crudrestcontrolleroptions.md) | Options to configure different aspects of a CRUD REST Controller. |
| [RepositoryClass](./rest-crud.repositoryclass.md) | |