2020-04-22 15:52:17 +02:00
|
|
|
import ApplicationComponent from "../ApplicationComponent";
|
2020-07-11 11:46:16 +02:00
|
|
|
import {Express} from "express";
|
2020-04-22 15:52:17 +02:00
|
|
|
import MysqlConnectionManager from "../db/MysqlConnectionManager";
|
|
|
|
|
2020-09-25 22:03:22 +02:00
|
|
|
export default class MysqlComponent extends ApplicationComponent {
|
2020-09-25 23:42:15 +02:00
|
|
|
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 {
|
2020-09-25 22:03:22 +02:00
|
|
|
return MysqlConnectionManager.isReady();
|
2020-04-22 15:52:17 +02:00
|
|
|
}
|
|
|
|
|
2020-09-25 23:42:15 +02:00
|
|
|
}
|