18 lines
602 B
TypeScript
18 lines
602 B
TypeScript
|
import ApplicationComponent from "../ApplicationComponent";
|
||
|
import {Express, Router} from "express";
|
||
|
import MysqlConnectionManager from "../db/MysqlConnectionManager";
|
||
|
|
||
|
export default class MysqlComponent extends ApplicationComponent<void> {
|
||
|
public async start(app: Express, router: Router): Promise<void> {
|
||
|
await this.prepare('Mysql connection', () => MysqlConnectionManager.prepare());
|
||
|
}
|
||
|
|
||
|
public async stop(): Promise<void> {
|
||
|
await MysqlConnectionManager.endPool();
|
||
|
}
|
||
|
|
||
|
public canServe(): boolean {
|
||
|
return MysqlConnectionManager.pool !== undefined;
|
||
|
}
|
||
|
|
||
|
}
|