aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/api/Chessh.ts (renamed from src/interfaces/Chessh.ts)0
-rw-r--r--src/api/index.ts2
-rw-r--r--src/interfaces/ErrorResponse.ts6
-rw-r--r--src/middlewares.ts4
4 files changed, 2 insertions, 10 deletions
diff --git a/src/interfaces/Chessh.ts b/src/api/Chessh.ts
index 898fccb..898fccb 100644
--- a/src/interfaces/Chessh.ts
+++ b/src/api/Chessh.ts
diff --git a/src/api/index.ts b/src/api/index.ts
index ae9b26a..39f5b40 100644
--- a/src/api/index.ts
+++ b/src/api/index.ts
@@ -3,7 +3,7 @@ import {
BotMoveRequest,
BotMoveAttempt,
BotMoveResponse,
-} from '../interfaces/Chessh';
+} from './Chessh';
import axios from 'axios';
import { aiMove } from 'js-chess-engine';
diff --git a/src/interfaces/ErrorResponse.ts b/src/interfaces/ErrorResponse.ts
deleted file mode 100644
index 1513e10..0000000
--- a/src/interfaces/ErrorResponse.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import MessageResponse from './MessageResponse';
-
-export default interface ErrorResponse extends MessageResponse {
- stack?: string;
- message: string;
-}
diff --git a/src/middlewares.ts b/src/middlewares.ts
index 249ff67..dc98a6c 100644
--- a/src/middlewares.ts
+++ b/src/middlewares.ts
@@ -1,7 +1,5 @@
import { NextFunction, Request, Response } from 'express';
-import ErrorResponse from './interfaces/ErrorResponse';
-
export function notFound(req: Request, res: Response, next: NextFunction) {
res.status(404);
const error = new Error(`🔍 - Not Found - ${req.originalUrl}`);
@@ -9,7 +7,7 @@ export function notFound(req: Request, res: Response, next: NextFunction) {
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
-export function errorHandler(err: Error, req: Request, res: Response<ErrorResponse>, next: NextFunction) {
+export function errorHandler(err: Error, req: Request, res: Response<{message: string, stack?: string | any[]}>, next: NextFunction) {
const statusCode = res.statusCode !== 200 ? res.statusCode : 500;
res.status(statusCode);
res.json({