swaf/src/components/MysqlComponent.ts

20 lines
571 B
TypeScript
Raw Normal View History

import {Express} from "express";
import ApplicationComponent from "../ApplicationComponent.js";
import MysqlConnectionManager from "../db/MysqlConnectionManager.js";
2020-04-22 15:52:17 +02:00
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 isReady(): boolean {
return MysqlConnectionManager.isReady();
2020-04-22 15:52:17 +02:00
}
}