# v50-load-controller

> Load controller function for v50 engine

Latest version **0.0.1** (published 2017-03-31) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install v50-load-controller
pnpm add v50-load-controller
yarn add v50-load-controller
bun add v50-load-controller
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2017-03-31 |
| First published | 2017-03-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Edgars Mjasņiokovs |
| Maintainers | mjasnikovs |
| Keywords | v50, config, controller |

## Links

- npm: https://www.npmjs.com/package/v50-load-controller
- Repository: https://github.com/mjasnikovs/v50-load-controller
- Homepage: https://github.com/mjasnikovs/v50-load-controller#readme
- Issues: https://github.com/mjasnikovs/v50-load-controller/issues
- npm.io page: https://npm.io/package/v50-load-controller

## Dependencies (1)

- [scpp](https://npm.io/package/scpp.md) ^1.0.4

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2017-03-31

## README

## v50-load-controller (ES6, ALFA)

v50-load-controller provides easy to use REST API (Could be you used for anything) configuration loading. No configuration files.
Create your API construction in natural human why, just create files and add them in proper project directory.
v50-load-controller will load policies, validation, and index function to execute.

## File structure example

```sh
└───controllers
    ├───session
    │   ├───add
    │   └───delete
    └───user
        ├───login
        └───logout
```

## Installation

```sh 
npm -i --save v50-load-controller
```

## API Reference

```sh
└───controllers // "Main directory"
    ├───session // "Controller name"
    │   ├───add 
    │   │       index.js // "Route 'session' 'add' index function"
    │   │       validate.js // "Validating passed parameters (optional)"
    │   │
    │   └───delete
    │           index.js
    │           validate.js
    │
    └───user
        │   policies.js // "Controller global policies, is applied to all actions in controller"
        │
        ├───login
        │       index.js
        │       policies.js // "Action policies, overwriting controller global policies"
        │       validate.js
        │
        └───logout
                index.js
                validate.js
```

Loading such structure will provide you object.

```JavaScript
{ session:
   { add: [ [Function], [Function] ],
     delete: [ [Function], [Function] ] },
  user:
   { login: [ [Function], [Function], [Function] ],
     logout: [ [Function], [Function], [Function] ] } }
```

### Example

```JavaScript
const v50LoadController = require('v50-load-controller')

v50LoadController(resolve('./test/controllers'), {}, (err, config) => {
	console.log(err)
	console.log(config)
})
```

### Optional

Optional, load single controller 

```JavaScript
v50LoadController(resolve('./test/controllers'), {controller: 'user'}, (err, config) => {
	console.log(err)
	console.log(config)
})
```

Optional, load single action 

```JavaScript
v50LoadController(resolve('./test/controllers'), {controller: 'user', action: 'login'}, (err, config) => {
	console.log(err)
	console.log(config)
})
```

For more examples see tests

## Tests

```npm test```

## Contributors

Edgars Mjasnikovs

## License

MIT

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