# adonis-gbox-provider

> Provider for integrating adonis framework into gaussbox api

Latest version **8.4.0** (published 2020-02-12) · 0 weekly downloads

## Install

```sh
npm install adonis-gbox-provider
pnpm add adonis-gbox-provider
yarn add adonis-gbox-provider
bun add adonis-gbox-provider
```

## 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 | 8.4.0 |
| Published | 2020-02-12 |
| First published | 2018-10-04 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 15.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ivan Jakab |
| Maintainers | ijakab |

## Links

- npm: https://www.npmjs.com/package/adonis-gbox-provider
- npm.io page: https://npm.io/package/adonis-gbox-provider

## Dependencies (1)

- [ioredis](https://npm.io/package/ioredis.md) 4.14.1

## Recent versions

- 8.4.0 (latest) — 2020-02-12
- 8.3.0 — 2019-11-19
- 8.2.0 — 2019-07-12
- 8.1.0 — 2019-06-17
- 8.0.1 — 2019-06-13
- 8.0.0 — 2019-06-13
- 7.0.3 — 2019-02-14
- 7.0.2 — 2019-02-11
- 7.0.1 — 2019-02-11
- 7.0.0 — 2019-01-29
- 6.0.1 — 2019-01-16
- 6.0.0 — 2019-01-15
- 5.3.4 — 2019-01-15
- 5.3.3 — 2018-12-10
- 5.3.2 — 2018-12-10
- … 38 more at https://npm.io/package/adonis-gbox-provider/versions

## README

# Adonis GaussBox provider
Provider for integrating adonis framework into GaussBox API

## Instalation

1. Install provider

`npm install adonis-gbox-provider`

2. Add configuration

Inside `config/database.js`

```javascript
crm: {
        client: 'mysql',
        connection: {
            host: Env.get('DB_CRM_HOST'),
            port: Env.get('DB_CRM_PORT'),
            user: Env.get('DB_CRM_USER'),
            password: Env.get('DB_CRM_PASSWORD'),
            database: Env.get('DB_CRM_DATABASE')
        },
        debug: Env.get('DB_DEBUG', false)
    }
```

Add appropriate variables to .env

**Only if using with adonis starter:**

Inside `config/gaussbox.js`

```javascript
module.exports = {
    routeExporter: {
        serviceName: 'cms-api',
        mapping: [
            {
                fileName: 'Post.js',
                prefix: 'posts'
            },
            {
                fileName: 'PostType.js',
                prefix: 'post-types'
            }
            /* and so on */
        ]
    }
}
```

3. Register providers

Inside `start/app.js`

```javascript
const providers = [
    'adonis-gbox-provider/Providers/GBoxProvider'
]
const aceProviders = [
    'adonis-gbox-provider/Providers/CommandsProvider'
]

```

4. Register middleware

Inside `start/kernel.js`

```javascript
const globalMiddleware = [
    'GBox/Parser',
]
```

5. Add to .env

Following variables:

GAUSSBOX_SECRETE

GAUSSBOX_GET_SECRET

IS_GBOX=true //*put to false if your requests do not go through master API (You are developing your app locally)*

*If using starter, still keep HandleResponse on top*

## Middleware

Middleware (`GBox/Parser`) will add to context following variables:

body

user

application

If IS_GBOX is set to true, it will parse those from master API request. Otherwise it will parse those from regular request

## Commands

signature | Description
--------- | -----------
`adonis gbox:routes`˙| This command works only on starter. It will export .json file containing information about routes
`adonis gbox:register` | Adds your routes to api, module and routes to database. Requires exported routes. If not using starter, and therefor command above, you need to provide this data file
`adonis gbox:registerActions` | Adds your rotes to crm database, not touching api and modules. Useful if you registered your api already and want to update routes. Same rules about starter as above.

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