Skip to content

aldahick/decorum

Repository files navigation

decorum

A classier version of Typescript decorators.

Usage:

Install the package: npm i @aldahick/decorum

const controllerDecorum = new ClassDecorum<[string]>();
const Controller = controllerDecorum.decorator;

@Controller("/users")
class UsersController {
  async get(): Promise<User[]> {
    return Users.find();
  }
}

const app = express();
const controllers = controllerDecorum.uses;
for (const controller of controllers) {
  app.use(controller.args[0], () =>
    new controller.target.constructor().get()
  );
}

About

A classier version of Typescript decorators.

Resources

License

Stars

Watchers

Forks

Packages

No packages published