# @chengaoyuan/controller

> 装饰器实现的Controller

Latest version **1.2.4** (published 2019-01-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @chengaoyuan/controller
pnpm add @chengaoyuan/controller
yarn add @chengaoyuan/controller
bun add @chengaoyuan/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 | 1.2.4 |
| Published | 2019-01-30 |
| First published | 2018-12-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 26 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | chengaoyuan |
| Maintainers | chengaoyuan |
| Keywords | controller |

## Links

- npm: https://www.npmjs.com/package/@chengaoyuan/controller
- Repository: https://github.com/GithubCGY/controller
- Homepage: https://github.com/GithubCGY/controller#readme
- Issues: https://github.com/GithubCGY/controller/issues
- npm.io page: https://npm.io/package/@chengaoyuan/controller

## Dependencies (1)

- [@chengaoyuan/argnames](https://npm.io/package/@chengaoyuan/argnames.md) ^1.0.4

## Recent versions

- 1.2.4 (latest) — 2019-01-30
- 1.2.3 — 2019-01-19
- 1.2.2 — 2019-01-19
- 1.2.1 — 2019-01-19
- 1.2.0 — 2019-01-18
- 1.1.4 — 2019-01-07
- 1.1.3 — 2019-01-07
- 1.1.2 — 2018-12-27
- 1.1.1 — 2018-12-27
- 1.1.0 — 2018-12-27
- 1.0.1 — 2018-12-22
- 1.0.0 — 2018-12-22

## README

# controller

[![npm version](https://badge.fury.io/js/%40chengaoyuan%2Fcontroller.svg)](https://badge.fury.io/js/%40chengaoyuan%2Fcontroller)

[![install size](https://packagephobia.now.sh/badge?p=@chengaoyuan/controller)](https://packagephobia.now.sh/result?p=@chengaoyuan/controller)

[![NPM Downloads](https://img.shields.io/npm/dm/@chengaoyuan/controller.svg?style=flat)](https://npmcharts.com/compare/@chengaoyuan/controller?minimal=true)

## Installation

    $ npm install @chengaoyuan/controller

## Usage

```ts
import * as express from "express";
import { Controller, RequestMapping, RequestPath, Request, Response } from "@chengaoyuan/controller";

const app = express();
app.use(Controller);
app.listen(1234, "0.0.0.0");

@Controller("/api")
class A {
    @RequestMapping({ path: "/test", method: "POST" })
    @RequestMapping({ path: "/test", method: "GET" })
    @RequestMapping({ path: "/test", method: "DELETE" })
    @RequestMapping({ path: "/test", method: "PUT" })
    async test(a: string, b: string) {
        return "OK";
    }

    @RequestMapping("/default_get/:path")
    async default_get(@RequestPath path: string, @Request req: any, @Response res: any) {
        return "OK";
    }
}
```

## Testing

    $ npm test

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