# autoload-module

> AutoLoad modules,models,files

Latest version **1.0.1** (published 2021-11-04) · ISC license · 0 weekly downloads

## Install

```sh
npm install autoload-module
pnpm add autoload-module
yarn add autoload-module
bun add autoload-module
```

## 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 | 2021-11-04 |
| First published | 2021-11-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | SAMAYUN CHOWDHURY |
| Maintainers | samayunmc |
| Keywords | Autoload, modules |

## Links

- npm: https://www.npmjs.com/package/autoload-module
- Repository: https://github.com/samayun/autoload-module
- Homepage: https://github.com/samayun/autoload-module#readme
- Issues: https://github.com/samayun/autoload-module/issues
- npm.io page: https://npm.io/package/autoload-module

## Recent versions

- 1.0.1 (latest) — 2021-11-04
- 1.0.0 — 2021-11-04

## README

# autoload-module

Autoload Modules, models, resolvers, services etc from any folder

## Installation

Installation is as simple as any other `npm` package:

```
$ npm install autoload-module
```

## Usage

- Autoload Modules, models, resolvers, services etc from any folder

## Example

### Autoload Mongoose Models

@return Object;
example given for [Penguin.js](https://github.com/samayun/penguin.js) modules

```js
/**
 * Auto Load all models using FileSystem
 */

const AutoLoad = require("autoload-module");

const modelObject = {};
function onLoad(module, moduleName) {
  // eslint-disable-next-line import/no-dynamic-require
  modelObject[moduleName] = require(module);
}

new AutoLoad(__dirname, "", onLoad).bootstrapModule();

module.exports = modelObject;
```

### Autoload REST Modules

@return array;
example given for [Penguin.js](https://github.com/samayun/penguin.js) modules

```js
/**
 * Auto Load module's routes using FileSystem
 */

const AutoLoad = require("autoload-module");

module.exports = (app) => {
  function onLoad(module) {
    // eslint-disable-next-line import/no-dynamic-require
    require(module)(app);
  }
  new AutoLoad(__dirname, "/routes", onLoad).bootstrapModule();
};
```

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