Skip to content
This repository was archived by the owner on May 16, 2023. It is now read-only.

routexjs/routex-inversify

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.

About

Inversify decorators for Routex

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published