36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import Application from "swaf/Application";
|
|
import Migration, {MigrationType} from "swaf/db/Migration";
|
|
import ExpressAppComponent from "swaf/components/ExpressAppComponent";
|
|
import LogRequestsComponent from "swaf/components/LogRequestsComponent";
|
|
import GiteaRepoLatestReleaseController from "./controllers/GiteaRepoLatestReleaseController";
|
|
import NunjucksComponent from "swaf/components/NunjucksComponent";
|
|
import packageJson = require('./package.json');
|
|
|
|
export default class App extends Application {
|
|
public constructor(
|
|
private readonly addr: string,
|
|
private readonly port: number,
|
|
) {
|
|
super(packageJson.version);
|
|
}
|
|
|
|
protected getMigrations(): MigrationType<Migration>[] {
|
|
return [];
|
|
}
|
|
|
|
protected async init(): Promise<void> {
|
|
this.registerComponents();
|
|
this.registerControllers();
|
|
}
|
|
|
|
private registerComponents() {
|
|
this.use(new ExpressAppComponent(this.addr, this.port));
|
|
this.use(new NunjucksComponent());
|
|
this.use(new LogRequestsComponent());
|
|
}
|
|
|
|
private registerControllers() {
|
|
this.use(new GiteaRepoLatestReleaseController());
|
|
}
|
|
}
|