Linting fixes.

This commit is contained in:
Patrick Fic
2025-03-28 15:58:38 -07:00
parent bf3f0205d6
commit ce6e9873a0
10 changed files with 69 additions and 72 deletions

View File

@@ -2,15 +2,17 @@ import cors from "cors";
import { app } from "electron";
import log from "electron-log/main";
import express from "express";
import { handleQuickBookRequest } from "../quickbooks-desktop/quickbooks-desktop";
import http from "http";
import errorTypeCheck from "../../util/errorTypeCheck";
import { handleQuickBookRequest } from "../quickbooks-desktop/quickbooks-desktop";
export default class LocalServer {
private app: express.Application;
private server: any;
private server: http.Server | null;
private PORT = 1337;
constructor() {
this.server = null;
this.app = express();
this.configureMiddleware();
this.configureRoutes();
@@ -96,10 +98,10 @@ export default class LocalServer {
private configureRoutes(): void {
// Basic health check endpoint
this.app.get("/health", (req: express.Request, res: express.Response) => {
this.app.get("/health", (_req: express.Request, res: express.Response) => {
res.status(200).json({ status: "ok" });
});
this.app.post("/ping", (req, res) => {
this.app.post("/ping", (_req, res) => {
res.status(200).json({
appVer: app.getVersion(),
qbPath: app.getPath("userData"), //TODO: Resolve to actual QB file path.
@@ -112,9 +114,11 @@ export default class LocalServer {
public start(): void {
try {
this.server = this.app.listen(this.PORT, (error: Error) => {
this.server = this.app.listen(this.PORT, (error: Error | undefined) => {
if (error) {
log.error(`[HTTP Server] Error starting server: ${error}`);
log.error(
`[HTTP Server] Error starting server: ${errorTypeCheck(error)}`,
);
} else {
log.info(
`[HTTP Server] Local HTTP server running on port ${this.PORT}`,