From 7fad4874ce31d7a585ef2143d06944d578f54ff1 Mon Sep 17 00:00:00 2001 From: Artemy Date: Mon, 14 Aug 2023 13:05:34 +0300 Subject: [PATCH] refactor: move types into single file --- src/app.ts | 16 ++-------------- src/schema/requests.types.ts | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 14 deletions(-) create mode 100644 src/schema/requests.types.ts diff --git a/src/app.ts b/src/app.ts index 28036ca..498ce84 100644 --- a/src/app.ts +++ b/src/app.ts @@ -3,8 +3,9 @@ import { ConfigService } from "./config/config.service"; import NodeCache from "node-cache"; import { readability } from "./handlers/readability"; import minify from "./handlers/main"; -import Fastify, { FastifyRequest } from "fastify"; +import Fastify from "fastify"; import middie from "@fastify/middie"; +import { Cached, EngineRequest, GetRequest } from "./schema/requests.types"; class App { config: IConfigService; cache: NodeCache; @@ -74,18 +75,5 @@ class App { } } -type GetRequest = FastifyRequest<{ - Querystring: { url: string; type?: string }; -}>; - -type EngineRequest = FastifyRequest<{ - Querystring: { url: string }; -}>; - -type Cached = { - content: string; - contentType: string; -}; - const app = new App(); app.init(); diff --git a/src/schema/requests.types.ts b/src/schema/requests.types.ts new file mode 100644 index 0000000..0906ba0 --- /dev/null +++ b/src/schema/requests.types.ts @@ -0,0 +1,14 @@ +import { FastifyRequest } from "fastify"; + +export type GetRequest = FastifyRequest<{ + Querystring: { url: string; type?: string }; +}>; + +export type EngineRequest = FastifyRequest<{ + Querystring: { url: string }; +}>; + +export type Cached = { + content: string; + contentType: string; +};