# think_controller

> Middleware Controller for ThinkKoa.

Latest version **2.0.6** (published 2017-11-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install think_controller
pnpm add think_controller
yarn add think_controller
bun add think_controller
```

## 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 | 2.0.6 |
| Published | 2017-11-22 |
| First published | 2017-06-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >8.0.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | richenlin |
| Maintainers | richenlin |

## Links

- npm: https://www.npmjs.com/package/think_controller
- Homepage: https://github.com/thinkkoa/think_controller
- Issues: https://github.com/thinkkoa/think_controller/issues
- npm.io page: https://npm.io/package/think_controller

## Dependencies (1)

- [think_lib](https://npm.io/package/think_lib.md) ^2.x.x

## Recent versions

- 2.0.6 (latest) — 2017-11-22
- 2.0.5 — 2017-11-21
- 2.0.2 — 2017-11-20
- 2.0.1 — 2017-11-16
- 1.2.0 — 2017-11-15
- 1.1.0 — 2017-11-13
- 1.0.3 — 2017-07-21
- 1.0.2 — 2017-06-19
- 1.0.1 — 2017-06-12
- 1.0.0 — 2017-06-08

## README

# 介绍
-----

[![npm version](https://badge.fury.io/js/think_controller.svg)](https://badge.fury.io/js/think_controller)
[![Dependency Status](https://david-dm.org/thinkkoa/think_controller.svg)](https://david-dm.org/thinkkoa/think_controller)

Middleware Controller for ThinkKoa.

# 安装
-----

```
npm i think_controller
```

# 使用
-----

1、controller中间件为thinkkoa内置中间件,无需在项目中创建引用。该中间件默认开启

2、项目中间件配置 config/middleware.js:
```
config: { //中间件配置
    ...,
    controller: {
        action_suffix: 'Action', //方法后缀,带后缀的方法为公共方法
        empty_action: '__empty', //空方法,如果访问控制器中不存在的方法,默认调用
        common_before: '__before', //控制器类公共前置方法,除私有方法外其他方法执行时自动调用
        self_before: '_before_', //控制器类某个方法自身的前置方法(前缀),该方法执行时自动调用
    }
}
```

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