# girgir

> Express Server Rest Api Input Type Controller

Latest version **2.0.1** (published 2021-10-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install girgir
pnpm add girgir
yarn add girgir
bun add girgir
```

## 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 | 2.0.1 |
| Published | 2021-10-24 |
| First published | 2021-08-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 92.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | YEK-PLUS |
| Maintainers | yek-plus |
| Keywords | express, expressjs, input, validate |

## Links

- npm: https://www.npmjs.com/package/girgir
- Repository: https://github.com/YEK-PLUS/girgir
- Homepage: https://github.com/YEK-PLUS/girgir#readme
- Issues: https://github.com/YEK-PLUS/girgir/issues
- npm.io page: https://npm.io/package/girgir

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2021-10-24
- 2.0.0 — 2021-10-02
- 1.1.0 — 2021-09-30
- 1.0.1 — 2021-08-25
- 1.0.0 — 2021-08-25

## README

# GIRGIR Express Plugin

girgir is a express.js middleware that checks input types.

## Installation

Install it using npm

```bash
npm install --save girgir
```

Install it using yarn

```bash
yarn add girgir
```

## Guide

girgir will uses rest api backend systems

### Using

```js
const express = require("express");
const app = express();

app.use(express.json());
app.use(girgir({}));
```

### Espacing

#### Input

```js
const nickName = {
  type: "string",
  maxLen: 14,
  minLen: 2,
},
```

#### Route

```js
const routes = {
  get: {
    ":user": {
      isPoint: true,
      user: INPUT,
      id: INPUT,
    },
  },
};
```

#### Deep Checking

If `isObject` is used, girgir will check deep params.

```js
const routes = {
  adres: {
    isObject: true,
    il: {
      isObject: true,
      slug: { type: "string" },
    },
    ilce: {
      isObject: true,
      slug: { type: "string" },
    },
    mahalle: {
      isObject: true,
      slug: { type: "string" },
    },
  },
};
```

#### Collection Checking

If `isCollection` is used, girgir will check object list (a.k.a collection).

```js
const routes = {
  adres: {
    isObject: true,
     names:{
      isCollection:true,
      slug:{
        type:'string'
      }
    },
  },
};
```

#### Array Checking

If `isArray` is used, girgir will check array.

```js
const routes = {
  adres: {
    isObject: true,
    arr:{
      isArray:true,
      type:"string"
    },
  },
};
```

#### Disable Deep Check Or Route

If `isDisabled` is used, girgir will ignore results for these section.

```js
const routes = {
  adres: {
    isObject: true,
    il: {
      isObject: true,
      slug: { type: "string" },
    },
    ilce: {
      isObject: true,
      slug: { type: "string" },
    },
    mahalle: {
      isDisabled: true,
      slug: { type: "string" },
    },
  },
};
```

### Config

Girgir using `.girgirrc.js` from project root path

```
├── /
├── post
└─┬ user
  └── login
```

```js
module.exports = {
  users: {
    public: {
      get: {
        ":user": {
          isPoint: true,
          user: {
            type: "string",
            maxLen: 14,
            minLen: 2,
          },
        },
        id: {
          isPoint: true,
          id: {
            type: "number",
            min: 0,
            max: 99,
          },
        },
      },
    },
    del: {
      ":id": {
        isPoint: true,
        id: {
          type: "number",
          min: 0,
          max: 99,
        },
      },
    },
  },
  posts: {
    get: {
      ":id": {
        isPoint: true,
        id: {
          type: "string",
        },
      },
    },
  },
};
```

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