From 0f5555b92915b175a685a24ade9276d170ae37f5 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Wed, 31 May 2023 19:11:57 -0700 Subject: move to docker compose, fuck vercel remove other unnecesaary stuff --- src/api/Chessh.ts | 19 +++++++++++++++++++ src/api/index.ts | 2 +- src/interfaces/Chessh.ts | 19 ------------------- src/interfaces/ErrorResponse.ts | 6 ------ src/middlewares.ts | 4 +--- 5 files changed, 21 insertions(+), 29 deletions(-) create mode 100644 src/api/Chessh.ts delete mode 100644 src/interfaces/Chessh.ts delete mode 100644 src/interfaces/ErrorResponse.ts (limited to 'src') diff --git a/src/api/Chessh.ts b/src/api/Chessh.ts new file mode 100644 index 0000000..898fccb --- /dev/null +++ b/src/api/Chessh.ts @@ -0,0 +1,19 @@ +export interface BotMoveRequest { + bot_id: number; + bot_name: string; + game_id: number; + fen: string; + turn: string; + bot_turn: boolean; + last_move: string; + status: string; +} + +export interface BotMoveAttempt { + token: string; + attempted_move: string; +} + +export interface BotMoveResponse { + message: string; +} 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/Chessh.ts b/src/interfaces/Chessh.ts deleted file mode 100644 index 898fccb..0000000 --- a/src/interfaces/Chessh.ts +++ /dev/null @@ -1,19 +0,0 @@ -export interface BotMoveRequest { - bot_id: number; - bot_name: string; - game_id: number; - fen: string; - turn: string; - bot_turn: boolean; - last_move: string; - status: string; -} - -export interface BotMoveAttempt { - token: string; - attempted_move: string; -} - -export interface BotMoveResponse { - message: string; -} 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, 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({ -- cgit v1.3