# @yshing/loopback-component-crud

> Loopback component Rest CRUD controller mixin (patched)

Latest version **1.5.4** (published 2021-02-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @yshing/loopback-component-crud
pnpm add @yshing/loopback-component-crud
yarn add @yshing/loopback-component-crud
bun add @yshing/loopback-component-crud
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.4 |
| Published | 2021-02-15 |
| First published | 2021-02-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10.16 |
| Dependencies | 9 |
| Unpacked size | 60.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | KoLiBer |
| Maintainers | yshing |
| Keywords | loopback-extension, loopback |

## Links

- npm: https://www.npmjs.com/package/@yshing/loopback-component-crud
- Repository: https://github.com/loopback4/loopback-component-crud
- npm.io page: https://npm.io/package/@yshing/loopback-component-crud

## Dependencies (9)

- [tslib](https://npm.io/package/tslib.md) ^2.0.0
- [@loopback/core](https://npm.io/package/@loopback/core.md) ^2.14.1
- [@loopback/rest](https://npm.io/package/@loopback/rest.md) ^9.1.2
- [@loopback/context](https://npm.io/package/@loopback/context.md) ^3.14.1
- [@loopback/security](https://npm.io/package/@loopback/security.md) ^0.3.6
- [@loopback/repository](https://npm.io/package/@loopback/repository.md) ^3.4.0
- [@loopback/authorization](https://npm.io/package/@loopback/authorization.md) ^0.7.7
- [@loopback/authentication](https://npm.io/package/@loopback/authentication.md) ^7.0.7
- [@loopback/model-api-builder](https://npm.io/package/@loopback/model-api-builder.md) ^2.1.20

## Recent versions

- 1.5.4 (latest) — 2021-02-15
- 1.5.3 — 2021-02-15
- 1.5.2 — 2021-02-15
- 1.5.1 — 2021-02-12
- 1.4.1 — 2021-02-07

## README

# loopback-component-crud

![Travis (.org) branch](https://img.shields.io/travis/loopback4/loopback-component-crud/master)
![npm](https://img.shields.io/npm/v/loopback-component-crud)
![npm bundle size](https://img.shields.io/bundlephobia/min/loopback-component-crud)
![GitHub](https://img.shields.io/github/license/loopback4/loopback-component-crud)

Creating `CRUD` endpoints in any application is a repetitive and futile task.

Using this extension you can generate a configurable `CRUD` endpoints with these features:

1. **Authentication**
2. **Authorization**
3. **Validation**
4. **Nested Create**
5. **Nested Update**

## Installation

```bash
npm i --save loopback-component-crud
```

## Usage

Follow these steps to add `CRUD` extension to your loopback4 application

1. Add `CRUDComponent` to your application (bind `model-api-builder`)
2. Add CRUD config files to `src/model-endpoints`

Now, let's try:

---

### Step 1 (CRUD Component)

Edit your `application.ts` file:

```ts
import { CRUDComponent } from "loopback-component-crud";

export class TestApplication extends BootMixin(
    ServiceMixin(RepositoryMixin(RestApplication))
) {
    constructor(options: ApplicationConfig = {}) {
        super(options);

        // Add crud component
        this.component(CRUDComponent);
    }
}
```

---

### Step 2 (Model Endpoint)

Now, you can generate your `CRUD` endpoints by creating `src/model-endpoints/mymodel.rest-config.ts`:

```ts
import { CRUDApiConfig } from "loopback-component-crud";
import { MyModel } from "../models";

module.exports = {
    model: MyModel,
    pattern: "CRUD",
    dataSource: "MyDataSource",
    basePath: "/mymodel",
    create: {},
    read: {},
    update: {},
    delete: {},
} as CRUDApiConfig;
```

---

## Contributors

-   [KoLiBer](https://www.linkedin.com/in/mohammad-hosein-nemati-665b1813b/)

## License

This project is licensed under the [MIT license](LICENSE.md).  
Copyright (c) KoLiBer (koliberr136a1@gmail.com)

---
_Source: https://npm.io/package/@yshing/loopback-component-crud · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
