@routex/inversify
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

Routex Inversify npm Travis CI Codecov

Inversify decorator for Routex.

Documentation - GitHub

Example

Install:

yarn add @routex/inversify
# or
npm add @routex/inversify

Setup your app:

import "reflect-metadata";
import { ICtx, TextBody } from "routex";
import {
  RoutexInversifyServer,
  TYPE,
  Get,
  Controller,
} from "@routex/inversify";
import { injectable } from "inversify";

@injectable()
@Controller("/test")
class TestController {
  @Get("/name/:name")
  getName(ctx: ICtx) {
    return new TextBody(ctx.params.name);
  }
}

const container = new Container();

container
  .bind(TYPE.Controller)
  .to(TestController)
  .whenTargetNamed("TestController");

const server = new RoutexInversifyServer(container);

const port = process.env.PORT || 3000;

server
  .build()
  .listen(port)
  .then(() => console.log(`Listening on ${port}`));

Support

We support all currently active and maintained Node LTS versions, include current Node versions.

Please file feature requests and bugs at the issue tracker.

Readme

Keywords

Package Sidebar

Install

npm i @routex/inversify

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

19.2 kB

Total Files

23

Last publish

Collaborators

  • cretezy