# tn-nestjs-route

Latest version **4.7.2** (published 2023-08-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install tn-nestjs-route
pnpm add tn-nestjs-route
yarn add tn-nestjs-route
bun add tn-nestjs-route
```

Provides the command `routegen`.

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.7.2 |
| Published | 2023-08-14 |
| First published | 2023-06-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 102.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Turnova |
| Maintainers | turnova |

## Links

- npm: https://www.npmjs.com/package/tn-nestjs-route
- Repository: https://github.com/JawadAhbab/tn-nestjs-route
- npm.io page: https://npm.io/package/tn-nestjs-route

## Dependencies (7)

- [ms](https://npm.io/package/ms.md) ^2.1.3
- [axios](https://npm.io/package/axios.md) ^1.4.0
- [fs-extra](https://npm.io/package/fs-extra.md) ^11.1.1
- [crypto-js](https://npm.io/package/crypto-js.md) ^4.1.1
- [tn-validate](https://npm.io/package/tn-validate.md) ^4.0.0
- [tn-typescript](https://npm.io/package/tn-typescript.md) ^1.2.3
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.22.5

## Recent versions

- 4.7.2 (latest) — 2023-08-14
- 4.7.1 — 2023-08-12
- 4.7.0 — 2023-08-11
- 4.6.2 — 2023-08-07
- 4.6.1 — 2023-08-07
- 4.6.0 — 2023-08-07
- 4.5.1 — 2023-07-10
- 4.5.0 — 2023-07-10
- 4.4.0 — 2023-07-10
- 4.3.1 — 2023-07-10
- 4.3.0 — 2023-07-10
- 4.2.1 — 2023-07-10
- 4.2.0 — 2023-07-10
- 4.1.2 — 2023-07-10
- 4.1.1 — 2023-07-10
- … 57 more at https://npm.io/package/tn-nestjs-route/versions

## README

## Server

### `HelloController.ts`

```ts
class BodySuper {
  @RouteBody() one: string
  @RouteBody() two: number
}

@Route('user')
class HelloRoute {
  @RouteSecure('secret') token: string
  @RouteParam() username: string
  @RouteParam() age: number
  @RouteIndexParam(0) serial: number
  @RouteBody() count: number
  @RouteBody({ type: BodySuper }) super: BodySuper
  @RouteBody({ type: [BodySuper] }) supermore: BodySuper[]
  @RouteFile() file: Express.Multer.File
  @RouteFile() files: Express.Multer.File[]
}

class ResultSuper {
  @RouteResult() rone: string
  @RouteResult() rtwo: string
}

class HelloResult {
  @RouteResult() resone: string
  @RouteResult() restwo: string
  @RouteResult({ type: ResultSuper }) super: ResultSuper
}

@Controller()
export class HelloController {
  @RouteGet(HelloRoute, HelloResult)
  hello(@RouteFields() fields: HelloRoute): HelloResult {
    return { ... }
  }
}
```

### `Routes.ts`

```ts
@Controller()
export class RoutesController {
  @Get('/routes') routes() {
    return routeSchemaCreator(controllers)
  }
}
```

## Client

### `routes.json`

```json
[
  {
    "site": "process.env.SITE",
    "cdn": "process.env.SITE_CDN",
    "cdnaccess": "process.env.SITE_CDN_ACCESS",
    "schema": "http://localhost:0000/routes",
    "outpath": "...",
    "loggerImport": "./logger",
    "loggerMethod": "routesLogger"
  }
]
```

### Generate Routes

`routegen`

## Middlewares

### RouteStatus

```ts
app.use(routeStatusMiddleware())
routeStatus.createSummery(sort)
```

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