# sequelize-cruds-router

> ### A fast way to add all cruds apis for a sequelize model

Latest version **1.0.1** (published 2020-08-08) · ISC license · 0 weekly downloads

## Install

```sh
npm install sequelize-cruds-router
pnpm add sequelize-cruds-router
yarn add sequelize-cruds-router
bun add sequelize-cruds-router
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-08-08 |
| First published | 2020-08-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | aadilbanaras1844 |

## Links

- npm: https://www.npmjs.com/package/sequelize-cruds-router
- npm.io page: https://npm.io/package/sequelize-cruds-router

## Dependencies (2)

- [joi](https://npm.io/package/joi.md) ^17.2.0
- [express](https://npm.io/package/express.md) ^4.17.1

## Recent versions

- 1.0.1 (latest) — 2020-08-08
- 1.0.0 — 2020-08-08

## README

# sequelize-cruds-router

### A fast way to add all cruds apis for a sequelize model

### How  to install
> npm i sequelize-cruds-router --save
### How to use
```
const {addSequelizeRouter} = require('sequelize-cruds-router');
app.use(addSequelizeRouter(SequelizeModel, options));
```
### Options possible values
* path, name of the api, by default it will be the model name, like /users
* prefix, prefix of the apis, by default it will be empty, you can pass /api/v1 or something like that
* skipDelete, pass as true if you want to skip delete api, false by default
* skipAdd, pass as true if you want to skip add api, false by default
* skipUpdate, pass as true if you want to skip update api, false by default
* skipFind, pass as true if you want to skip find api, false by default
* skipGet, pass as true if you want to skip get api, false by default

### Default Apis
* **GET** /model , returns list of objects, you can pass search params
*  **GET** /model/id, returns the object on that id
*  **POST** /model, pass params as form to create object
*  **PUT** /model/id, pass params needed to update on object under this id
*  **DELETE** /model/id, deletes object on this id

### Features
* Joi validation will be added on the basis of model schema on apis
* It does't take any databse credentials, or db objects, everything  will be in your code. Just pass sequelize model, it will use the model to add apis, functions.
* On error, it will pass error object on next, you can manage errir handle on your code, it will do, next(err)
### People
Author [Muhammad Aadil](https://github.com/aadilbanaras1844)

---
_Source: https://npm.io/package/sequelize-cruds-router · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
