# nuxt-ioc

> Nuxt IOC implementation

Latest version **1.2.1** (published 2021-03-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install nuxt-ioc
pnpm add nuxt-ioc
yarn add nuxt-ioc
bun add nuxt-ioc
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2021-03-29 |
| First published | 2020-09-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 487.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Mateusz Gachowski |
| Maintainers | mateuszgachowski |
| Keywords | ioc, nuxt, inversion, di |

## Links

- npm: https://www.npmjs.com/package/nuxt-ioc
- Repository: https://github.com/mateuszgachowski/nuxt-ioc
- Homepage: https://github.com/mateuszgachowski/nuxt-ioc#readme
- Issues: https://github.com/mateuszgachowski/nuxt-ioc/issues
- npm.io page: https://npm.io/package/nuxt-ioc

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 1.2.1 (latest) — 2021-03-29
- 1.2.0 — 2021-03-25
- 1.1.0 — 2021-03-08
- 1.0.18 — 2021-02-23
- 1.0.17 — 2021-01-04
- 1.0.15 — 2020-12-24
- 1.0.14 — 2020-12-21
- 1.0.13 — 2020-11-09
- 1.0.12 — 2020-11-09
- 1.0.8 — 2020-10-29
- 1.0.7 — 2020-09-26
- 1.0.6 — 2020-09-08
- 1.0.5 — 2020-09-08
- 1.0.4 — 2020-09-08
- 1.0.3 — 2020-09-08
- … 3 more at https://npm.io/package/nuxt-ioc/versions

## README

# nuxt-ioc - IOC containers for Vue/Nuxt frameworks

IoC/DI for Nuxt.js framework powered by [Inversify.js](http://inversify.io/) and inspired by great [Java Spring](https://spring.io/) and [Nest.js](https://nestjs.com/) frameworks.

## Requirements

- [Nuxt.js](https://nuxtjs.org/)
- [Vue 2.x](https://vuejs.org/)
- `@nuxt/typescript-build` module [installed](https://typescript.nuxtjs.org/guide/setup.html#installation)

## Quick start

Please refer to our [documentation](https://mateuszgachowski.github.io/nuxt-ioc/) for complete guide.

## Example code

```html
<template>
  <div>My component content</div>
</template>

<script lang="ts">
  import { Injectable, BaseComponent, Inject, factory } from 'nuxt';
  import MyService from '~/Application/MyService';

  @Injectable()
  export class MyComponent extends BaseComponent {
    @Inject(MyService)
    private gMyService: MyService;

    public async $fetch(): Promise<void> {
      await this.gMyService.getMyData();
    }

    public $mounted(): void {
      console.log('this is Vue mounted life hook');
    }
  }

  export default factory(MyComponent);
</script>
```

## Local Test

If you want test our example locally, you need change coreModule ind the index.ts

```javascript
const options = {
  // @ts-ignore
  containerPath: '~/Application/container',
  coreModule: '../../',
  // coreModule: 'nuxt-ioc',
  ...moduleOptions,
};
```

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