0.1.1 • Published 4 years ago

@routex/inversify v0.1.1

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

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.

0.1.1

4 years ago

0.1.0

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago