# slim-nestjs

> a slim version of the nestjs

Latest version **0.0.5-beta1** (published 2020-10-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install slim-nestjs
pnpm add slim-nestjs
yarn add slim-nestjs
bun add slim-nestjs
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5-beta1 |
| Published | 2020-10-14 |
| First published | 2020-10-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 11.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | jellyxiong |
| Maintainers | jellyxiong |
| Keywords | bff, koa |

## Links

- npm: https://www.npmjs.com/package/slim-nestjs
- Repository: https://github.com/TianlunXiong/slim-nestjs
- npm.io page: https://npm.io/package/slim-nestjs

## Dependencies (7)

- [koa](https://npm.io/package/koa.md) ^2.13.0
- [@types/koa](https://npm.io/package/@types/koa.md) ^2.11.4
- [koa-router](https://npm.io/package/koa-router.md) ^9.4.0
- [typescript](https://npm.io/package/typescript.md) ^4.0.3
- [@types/node](https://npm.io/package/@types/node.md) ^14.11.2
- [ts-node-dev](https://npm.io/package/ts-node-dev.md) ^1.0.0-pre.63
- [@types/koa-router](https://npm.io/package/@types/koa-router.md) ^7.4.1

## Recent versions

- 0.0.5-beta1 (latest) — 2020-10-14
- 0.0.5 — 2020-10-14
- 0.0.4 — 2020-10-14
- 0.0.3 — 2020-10-14
- 0.0.2 — 2020-10-14
- 0.0.1 — 2020-10-14

## README

# Slim NestJS

## Introduction

A Dependency-Inject Framework Based On Koa. A Reduced Version Of The Well-Known Framework NestJS.

## ToDo
- [x] 控制器的基本修饰器（Controller、Get、Post等）
- [x] 控制器的依赖注入
- [ ] 中间件的依赖注入（待测试）
- [x] 请求/响应循环基本节点
- [ ] 日志系统
- [ ] 可视化监控系统
- [ ] 测试用例
- [ ] 集成前端Webpack开发环境
- [ ] 集成ORM数据库管理系统

## install

```
yarn add slim-nestjs
```

## usage

The App is actually equivalent to Koa as well known. The related  APIs can be found in https://koajs.com or https://www.koajs.com.cn

### 1. run server

```ts
// index.ts

import App from 'slim-nestjs';

const app = new App(); // as new Koa()
const PORT = 9001;

app.use(async (ctx, next) => {
  await next();
  ctx.body = 'Hello World!'
})
app.routes(); // resolve controllers and middlewares 
app.listen(PORT, () => console.log(`the server run on ${PORT}`));

```

### 2. add controller

```ts
// controller.hello.ts

import { Context, Next, Controller, Get } from 'slim-nestjs';

@Controller('prefix')
class Hello {
  constructor(private inject: AllList) {}

  @Get()
  score(ctx: Context) {
    ctx.body = 'Hello World!';
  }

  @Get('api/:id')
  async student(ctx: Context) {
    const { id } = ctx.params
    ctx.body = `api, ${id}`;
  }
}

export { LikeMiddleWare, Xiaobai };

```

then

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