Inversify decorator for Routex.
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}`));
We support all currently active and maintained Node LTS versions, include current Node versions.
Please file feature requests and bugs at the issue tracker.