swaf/src/components/MysqlComponent.ts

20 lines
571 B
TypeScript

import {Express} from "express";
import ApplicationComponent from "../ApplicationComponent.js";
import MysqlConnectionManager from "../db/MysqlConnectionManager.js";
export default class MysqlComponent extends ApplicationComponent {
public async start(_app: Express): Promise<void> {
await this.prepare('Mysql connection', () => MysqlConnectionManager.prepare());
}
public async stop(): Promise<void> {
await MysqlConnectionManager.endPool();
}
public isReady(): boolean {
return MysqlConnectionManager.isReady();
}
}