swaf/src/components/MysqlComponent.ts

19 lines
565 B
TypeScript
Raw Normal View History

2020-04-22 15:52:17 +02:00
import ApplicationComponent from "../ApplicationComponent";
import {Express} from "express";
2020-04-22 15:52:17 +02:00
import MysqlConnectionManager from "../db/MysqlConnectionManager";
export default class MysqlComponent extends ApplicationComponent {
public async start(_app: Express): Promise<void> {
2020-04-22 15:52:17 +02:00
await this.prepare('Mysql connection', () => MysqlConnectionManager.prepare());
}
public async stop(): Promise<void> {
await MysqlConnectionManager.endPool();
}
public canServe(): boolean {
return MysqlConnectionManager.isReady();
2020-04-22 15:52:17 +02:00
}
}