update.eternae.ink/src/App.ts

36 lines
1.1 KiB
TypeScript
Raw Normal View History

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');
2020-04-23 18:07:55 +02:00
2020-06-27 17:20:06 +02:00
export default class App extends Application {
2020-10-05 13:38:03 +02:00
public constructor(
private readonly addr: string,
private readonly port: number,
) {
super(packageJson.version);
2020-04-23 18:07:55 +02:00
}
2020-10-05 13:38:03 +02:00
protected getMigrations(): MigrationType<Migration>[] {
return [];
2020-04-23 18:07:55 +02:00
}
protected async init(): Promise<void> {
this.registerComponents();
this.registerControllers();
}
private registerComponents() {
this.use(new ExpressAppComponent(this.addr, this.port));
2020-04-23 18:07:55 +02:00
this.use(new NunjucksComponent());
this.use(new LogRequestsComponent());
}
private registerControllers() {
this.use(new GiteaRepoLatestReleaseController());
2020-04-23 18:07:55 +02:00
}
2020-10-05 13:38:03 +02:00
}