1.2.4 • Published 5 years ago

@chengaoyuan/controller v1.2.4

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

controller

npm version

install size

NPM Downloads

Installation

$ npm install @chengaoyuan/controller

Usage

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
1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago