dependency injector support for deno oak framework.
import { Application } from "https://deno.land/x/oak/mod.ts";
import { GeneratorFromClass, Restful, List, Query, Default, Controller } from "https://deno.land/x/oak_injector/mod.ts";
const app = new Application();
// ...
@Restful("/test")
class TestController extends Controller {
@List()
List(@Query("page") @Default("10") page: number) {
// ...
this.ctx.response.body = page;
// ...
}
}
// ...
app.use(GeneratorFromClass(TestController).routes());
await app.listen({ port: 80 });
then access
http://127.0.0.1/test?page=20
This repo is working in progress now, APIs will be incompatible in the future.
Feel free to submit an issue if you have any problems or suggestions when using oak-injector.
Author: narrowizard
Source Code: https://github.com/narrowizard/oak-injector
#deno #nodejs #javascript #node