!! Not Ready for Prime Time, Experimental !!
Decorator package of galatajs
framework.
npm install @galatajs/decorators
Enable decorators in your tsconfig.json
:
{
"compilerOptions": {
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
}
Main file
import { createApp, App } from "@galatajs/app";
import { createDecoratorApp } from "@galatajs/decorators";
import { mainModule } from "./src/main.module";
const app: App = createApp(mainModule);
app.register(createDecoratorApp());
app.start();
In Controller
import { Controller, Get } from "@galatajs/decorators";
import { Request, Response } from "@galatajs/http";
@Controller("some")
export class SomeController {
@Get("test")
test(req: Request, res: Response) {
return res.success("test");
}
}
In Module
import { createModule, Module } from "@galatajs/app";
import { SomeController } from "./some.controller";
const module: Module = createModule({
providers: [SomeController],
});