# typescript-rest-ioc

> A Typescript-Rest Service Factory to integrate it wit typescript-ioc.

Latest version **1.0.1** (published 2021-06-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install typescript-rest-ioc
pnpm add typescript-rest-ioc
yarn add typescript-rest-ioc
bun add typescript-rest-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.0.1 |
| Published | 2021-06-10 |
| First published | 2020-02-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 54.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Thiago da Rosa de Bustamante |
| Maintainers | trbustamante |
| Keywords | typescript-rest, rest, ioc, di, cdi, javascript, typescript, node, dependency injection, dependency inversion, inversion of control container |

## Links

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

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ^4.17.15

## 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.0.1 (latest) — 2021-06-10
- 1.0.0 — 2020-02-27

## README

[![npm version](https://badge.fury.io/js/typescript-rest-ioc.svg)](https://badge.fury.io/js/typescript-rest)
![Master Workflow](https://github.com/thiagobustamante/typescript-rest-ioc/workflows/Master%20Workflow/badge.svg)
[![Coverage Status](https://codecov.io/gh/thiagobustamante/typescript-rest-ioc/branch/master/graph/badge.svg)](https://codecov.io/gh/thiagobustamante/typescript-rest-ioc)

# Typescript-Rest with IoC

After install Typescript-Rest, install the IoC container and the serviceFactory for the IoC Container

```bash
npm install typescript-rest --save
npm install typescript-ioc --save
npm install typescript-rest-ioc --save
```

Then add a rest.config file in the root of your project:

```json
{
  "serviceFactory": "typescript-rest-ioc"
}
```

And you can use Injections, Request scopes and all the features of the IoC Container. It is possible to use it with any other IoC Container, like Inversify.

Example:

```typescript
class HelloService {
  sayHello(name: string) {
    return "Hello " + name;
  }
}

@Path("/hello")
class HelloRestService {
  @Inject
  private helloService: HelloService;

  @Path(":name")
  @GET
  sayHello( @PathParam('name') name: string): string {
    return this.helloService.sayHello(name);
  }
}
```

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